R-metafor 森林图:如何省略空的顶行? [英] R-metafor forest plot: how to omit empty top rows?

查看:47
本文介绍了R-metafor 森林图:如何省略空的顶行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

metafor::forest 通过在图的顶部创建一条水平线和三个空白行来准备标题等.有没有办法避免这种情况?

metafor::forest prepares for headings etc by creating a horizontal line and three blank rows in the top of the plot. Is there a way to avoid that?

我也遇到过这样的问题:

I have too cases where this poses a problem:

  • 对于简单的森林图,一个标题行就足够了.我必须使用 text 而不是 title 在水平线上方手动添加标题,然后裁剪图像.
  • 我想使用 addpoly 创建一个纯汇总估计的森林图.由于间距和水平线,我必须裁剪图像的顶部
  • For a simple forest plot, one header row is sufficient. I have to manually add a title just above the horizontal line using text rather than title and then crop the image afterwards.
  • I want to create a forest plot of pure summary estimates using addpoly. I have to crop the top of the image because of the spacing and horizontal line

推荐答案

要摆脱顶部的一些额外空间,您可以使用:

To get rid of some of that extra space at the top, you can use:

par(mar=c(5,4,0,2))

在创建绘图之前.关键的是第三个值.

before you create the plot. The crucial one is the third value.

水平线是硬编码的.你可以考虑在它上面画一条白线来隐藏它(是的,有点黑客......).一个例子:

The horizontal line is hardcoded. You could just consider drawing a white line on top of it that will hide it (yes, a bit hackish ...). An example:

library(metafor)
dat <- escalc(measure="RR", ai=tpos, bi=tneg, ci=cpos, di=cneg, data=dat.bcg)
res <- rma(yi, vi, data=dat)
par(mar=c(5,4,0,2))
forest(res)
abline(h=res$k+1, lwd=2, col="white")

如果你需要挤出更多空间,你可以试试这个:

If you need to squeeze out even more space, you could try this:

forest(res, refline=NA, ylim=c(-1.5, res$k+0.5))
abline(h=res$k-1.5, lwd=2, col="white")

这篇关于R-metafor 森林图:如何省略空的顶行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆