如何在 R 包林图中添加第二条垂直线


我想

在我的森林图中区分统计学意义(OR = 1.0(和临床意义(OR = 1.5(。我使用森林绘图包创建了这个图,下面的示例代码。是否可以添加垂直线(同时保持无差异线(?

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
       )

这是你要找的吗?

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)

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

相关内容

  • 没有找到相关文章

最新更新