0

我使用 Forestplot 包在 r 中制作了一个森林图。代码如下:

#forestplot 


labeltext2 <- c("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "Summary Effect")

effect2 <- c(0.12, 0.61, 0.11, 0.25, 0.24, 0.63, 0.33, 0.41, 0.38, 0.52, 0.23, 0.47,
         0.32, 0.36, 0.03, 0.15, 0.25, 0.67, 0.003, 0.32)


lower_2 <- c(0.08, 0.51, .03, 0.11, 0.06, 0.62, 0.11, 0.29, 0.18, 
         0.4, 0.19, 0.39, 0.24, 0.39, -0.13, 0.01, 0.09, 0.43,
         -0.08, 0.19)

higher_2 <- c(0.16, 0.71, .19, 0.39, 0.42, 0.64, 0.55, 0.53, 0.58, 
          0.64, 0.27, 0.55, 0.4, 0.4, 0.19, 0.29, 0.41, 0.91,
          0.08, 0.44)

forestplot(labeltext2, effect2, lower_2, higher_2, zero = .32,
       cex = 2, 
       lineheight = "auto",
       xlab = "effect size",
       xticks = c(-.5, 0, .5, 1, 1.5),
       title = "ForestPlot",
       new_page = TRUE)

这让我得到这个图像: 森林图

此图像有一条效果线出现在 0.32 处,即摘要效果,使用零参数。我想在 0 处添加一条额外的粗黑线以显示“无效”线。有谁知道怎么做?我愿意使用另一个包/功能。

谢谢!

4

1 回答 1

0

我无法弄清楚 Forestplot 如何使用网格图形,但这里有一个手动解决方案:

forestplot(labeltext2, effect2, lower_2, higher_2, zero = .32,
           cex = 2, 
           lineheight = "auto",
           xlab = "effect size",
           xticks = c(-.5, 0, .5, 1, 1.5),
           title = "ForestPlot",
           new_page = TRUE)

# Add line manually
x = .397
y0 = .12
y1 = .875
grid.lines(c(x, x), c(y0, y1), default.units = "npc",
           gp = gpar(lwd = 2))
于 2016-08-01T19:20:48.350 回答