0

我正在尝试在我的风险比森林图上使用对数刻度。我将风险比估计值和置信区间手动输入到我的绘图中,但我需要相同的值(未更改)在绘制时处于对数刻度上。最好使用与当前在算术刻度上的绘图相同的刻度线。是否有捷径可寻?

我尝试了 atransf = exp,它改变了我所有的风险比。我还尝试了 = log(c(0.25, 0.5, 1, 2, 4, 6)),它彻底改变了所有刻度线。如何在不更改轴的数字刻度线和危险值的情况下转换为对数刻度?

谢谢你的帮助。

#Forest Plot
label1 <- as.character(c("<50", "50 to <60", "60"))
label1 <- factor(label1, levels = unique(label1))
hazards1 <- c(1.42, 1.66, 2.85)
lower1 <- c(1.34, 1.50, 2.59)
upper1 <- c(1.51, 1.85, 3.13)
patient_num1 <- c(240000, 180000, 220000)
event_num1 <- c(2600, 1300, 2900)
forestplot1 <- data.frame(label1, hazards1, lower1, upper1, event_num1, patient_num1)
forestplot1$patient_num1 <- rev(forestplot1$patient_num1)

par(mar=c(4,4,1,2))
pdf(file = "figureex.pdf", width = 15, height = 8.5)
pdf.options(encoding='ISOLatin2.enc')
forest(rev(hazards1), ci.lb = rev(lower1), ci.ub = rev(upper1), slab = rev(label1), xlim = c(-4,0), 
       xlab = "Adjusted Hazard Ratio for Event", 
       refline = 1, annotate = T, ylim = c(-1, 29), ilab = cbind(forestplot1$patient_num1, rev(event_num1)),
       ilab.xpos=c(-1,-0.25), at = c(0.25, 0.5, 1, 2, 4, 6), rows = c(1:3),
       cex = 1, yaxs = "i")
text(-4, 27.29, pos = 4, "Variable")
text(-1.25, 27.67, pos = 4, "No. of \nPatients")
text(-0.45, 27.67, pos = 4, "No. of \nEvents")
text(5.05, 27.69, pos = 4, "Hazard Ratio \n(95% CI)")
dev.off()
4

1 回答 1

1

看起来您正在使用包forest中的功能metaforforestplot包中的函数forestplot允许您使用 指定刻度线xticks以及使用对数刻度来标记刻度线xlog

于 2019-08-23T18:17:19.570 回答