2

我想在我的森林图中区分统计显着性(OR = 1.0)和临床显着性(OR = 1.5)。我使用 forestplot 包创建了这个图,示例代码如下。是否可以添加垂直线(同时保持没有差异的线)?

library(forestplot)
test_data <- structure(list(
   mean = c(NA, NA, 1, 0.5, 2),
   lower = c(NA, NA, .5, .25, 1.5),
   upper = c(NA, NA, 1.5, .75, 2.5)),
   .Names = c("mean", "lower", "upper"),
   row.names = c(NA, -5L),
   class = "data.frame")

tabletext <- cbind(
   c("", "Outcome", "Outcome 1", "Outcome 2", "Outcome 3"),
   c("", "OR", "1 (0.5 - 1.5)", "0.5 (0.25 - 0.75)", "2.0 (1.5 - 2.5)"))

forestplot(tabletext,
       test_data,
       new_page = TRUE,
       xlog = TRUE,
       boxsize = .25
       )
4

2 回答 2

2

这是你要找的吗?

forestplot(tabletext,
       test_data,
       new_page = TRUE,
       xlog = TRUE,
       grid = structure(c(log(1.5)), 
                        gp = gpar(lty = 2, col = "#CCCCFF")), 
       zero = 1,
       boxsize = .25)
于 2018-05-28T22:26:51.687 回答
0

一个次优(而且不是很优雅)的解决方案可能是:1-创建一个没有轴或标签的空图,2-然后绘制一条垂直线 ( abline(v=1.5)) 并 3-调用你的forestplotwith new_page = F

于 2017-04-02T05:36:03.410 回答