metafor:森林去除或移动元元音柱
我试图改变我的森林情节的形式,以准备出版。
我想移动最终的右侧列,该列显示当前显示效果估计值(在我的情况下,赔率比)。这列是固定在图的右侧,还是可以移动,使其与其他列对齐,森林图本身在最右侧。
这是我目前的森林情节代码,
# Forest plot of odds ratio
options(na.action = "na.pass")
forest(res.or,
addpred=TRUE, header=TRUE,
atransf=exp,
order = ormri$year,
xlim = c(-22,10),
ilab=cbind(m1$hiv, m1$con, m1$diffci),
ilab.xpos=c(-14, -10, -5),
ilab.pos = 2,
mlab = "",
digits = 2, cex = 0.75,
col = "blue",
xlab = c("Odds Ratio"),
at=log(c(0.1, .25, 1, 10, 100)))
text(c(-15.5, -11.5, -6.5), 16.5, c("LGE+/N (%)", "LGE+/N (%)", "Diff [95% CI]"), cex=0.75)
text(c(-15.5, -11.5), 17.5, c("HIV+", "HIV -"), font =2, cex = 0.75)
## add text with Q-value, dfs, p-value, and I^2 statistic
text(-22, -1, pos=4, cex=0.75, bquote(paste("RE Model (Q = ",
.(formatC(res.or$QE, digits=2, format="f")), ", df = ", .(res.or$k - res.or$p),
", p = ", .(formatC(res.or$QEp, digits=2, format="f")), "; ", I^2, " = ",
.(formatC(res.or$I2, digits=1, format="f")), "%)")))
它赋予了这个情节
我想将优势比列与diff [95 ci]列并肩移动。
I am attempting to change the format of my forest plot to prepare for publication.
I would like to move the far right hand column that shows the effect estimate currently (in my case odds ratios). Is this column fixed to the right hand side of plot or can it be moved so that it aligns with the other columns and the forest plot itself is on the far right hand side.
This is my current forest plot code
# Forest plot of odds ratio
options(na.action = "na.pass")
forest(res.or,
addpred=TRUE, header=TRUE,
atransf=exp,
order = ormri$year,
xlim = c(-22,10),
ilab=cbind(m1$hiv, m1$con, m1$diffci),
ilab.xpos=c(-14, -10, -5),
ilab.pos = 2,
mlab = "",
digits = 2, cex = 0.75,
col = "blue",
xlab = c("Odds Ratio"),
at=log(c(0.1, .25, 1, 10, 100)))
text(c(-15.5, -11.5, -6.5), 16.5, c("LGE+/N (%)", "LGE+/N (%)", "Diff [95% CI]"), cex=0.75)
text(c(-15.5, -11.5), 17.5, c("HIV+", "HIV -"), font =2, cex = 0.75)
## add text with Q-value, dfs, p-value, and I^2 statistic
text(-22, -1, pos=4, cex=0.75, bquote(paste("RE Model (Q = ",
.(formatC(res.or$QE, digits=2, format="f")), ", df = ", .(res.or$k - res.or$p),
", p = ", .(formatC(res.or$QEp, digits=2, format="f")), "; ", I^2, " = ",
.(formatC(res.or$I2, digits=1, format="f")), "%)")))
Which gives this plot
I would like to move the ODDS RATIO column to be alongside the diff[95 CI] column.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不久前,有人要求我调整研究标签的位置(左侧)和注释(右侧)。为此,我添加了
textpos
参数。请参阅:https:/ metafor/reference/forest.rma.html#afre-arguments-1
使用这个示例,我可以说明如何使用此示例。交换
forest()
和text()
与此相关的部分:voila,注释在实际森林图的左侧。找到
xlim
,iLab.xpos
和textpos
的良好值是有点痛苦的绘图设备),但似乎您已经花了一些时间来处理此操作,因此现在您再次经历了该过程。Somebody asked me a while ago to make it possible to adjust the position of the study labels (on the left) and the annotations (on the right). For this, I have added the
textpos
argument. See:https://wviechtb.github.io/metafor/reference/forest.rma.html#additional-arguments-1
Using this example, I can illustrate how to make use of this. Swap out the
forest()
andtext()
parts with this:and voila, the annotations are to the left of the actual forest plot. It's a bit of pain to find good values for
xlim
,ilab.xpos
, andtextpos
to make everything look nice (within the actual dimensions of the plotting device), but it seems like you've already spent some time dealing with this, so now you just have go through that process once more.