【问题标题】:Adding gaps in data for forest plot in metafor在 metafor 中为森林图添加数据间隙
【发布时间】:2017-01-04 17:11:54
【问题描述】:

我是 R 新手,正在使用 metafor 包的 forest.default 实现(我在数据中只有 xci.ubci.ub森林地块)

我差不多完成了,我的绘图看起来类似于this,除了我的数据超出了图表顶部的黑色水平边框。我使用它,但我有一个森林图总是与水平边界在同一行,并且如here 所述,用白线叠加也无济于事。

我的问题是:如何在我的数据集中添加间隙,以便森林图本身将黑色边框向上移动?This is the image of the plot currently with the border (currently superimposed with a white line) cutting through my data

谢谢!

编辑:这是代码的 sn-p

 require(metafor)
  metafor::forest(
    x = as.vector(t(data_set[, forest_plot$mean])),
    xlim = c(min_x_value - 2 * (plot_span), max_x_value), 
    alim = c(min_x_value , max_x_value),
    ci.lb = as.vector(t(data_set[, forest_plot$low])),
    ci.ub = as.vector(t(data_set[, forest_plot$high])),
    col = "darkgoldenrod4",
    ilab = display_data_matrix,
    ilab.pos = 4,
    annotate = FALSE,
    slab = NA,
    ilab.xpos = c(min_x_value - 2 * plot_span, min_x_value - 1.5 * plot_span, min_x_value - 0.75 * plot_span, min_x_value - 0.25 * plot_span),
    rows = row_groupings,
    xlab = paste(measure, ep_type, ep)
  )
  # print("e")
  text(min_x_value - 2* plot_span, subgroup_rows, col = "brown3", pos = 4 , subgroup_titles, cex = 1.2)
  header_line <- dim(data_set)[1] + gaps + 1
  text( c(min_x_value - 2 * plot_span, 
          min_x_value - 1.5 * plot_span,
          min_x_value - 0.75 * plot_span,
          min_x_value - 0.25 * plot_span),
        pos = 4,
        cex = 1.4,
        col = "darkorchid4",
        header_line, c("Trial", "Randomized Treatment", "N Arm", "Time") )

  abline(h=dim(data_set)[1]+1, lwd=2, col="white")

【问题讨论】:

    标签: r forestplot metafor


    【解决方案1】:

    您需要调整ylim 参数。执行以下操作:

    sav <- forest(x = [...])
    sav
    

    (其中[...] 是您的所有其余代码)。然后看看ylim 的默认值是什么。通过将上限值加 2 来调整此值(因为您为子组标题添加了两行),然后在调用 forest() 时使用 ylim=c(lower,upper)

    【讨论】:

    • 谢谢教授!你确实是统计学家可以非常友好和适应社会的活生生的证明!
    猜你喜欢
    • 1970-01-01
    • 2016-11-12
    • 1970-01-01
    • 1970-01-01
    • 2022-12-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多