查看漏斗图示例,在metafor页面上 - 似乎有一种方法可以在漏斗图中添加标签.该漏斗图页面提供了更多的细节,但它没有列出添加标签的例子.
提供的示例:
library(metafor)
png(filename="contour_enhanced_funnel_plot.png",
res=92, width=680, height=600, type="cairo")
par(mar=c(5,4,1,2))
data(dat.bcg)
res <- rma(ai=tpos, bi=tneg, ci=cpos, di=cneg, data=dat.bcg, measure="RR",
slab=paste(author, year, sep=", "), method="REML")
funnel(res, level=c(90, 95, 99), shade=c("white", "gray", "darkgray"), refline=0)
dev.off()
Run Code Online (Sandbox Code Playgroud)
包含标签字段,但示例中未生成任何标签字段.如何在漏斗图中添加标签?
看这里,似乎使用pch可能是另一种选择.有点像:
pch=paste(StudyName, StudyMeasure, sep=", ")
Run Code Online (Sandbox Code Playgroud)
但这只产生一个字母点..
rma()当浏览和的来源funnel.rma()(来自 Metafor 1.9-2 版本)时,我找不到任何将标签放入漏斗图中的具体规定。然而,为了绘制自己的标签,这些位置原则上似乎可以从rma对象中重现,因此人们可以在这些数字的基础上进行构建,而不必重新计算所有内容。当然,这种方法至少取决于yaxis- 参数的选定值,但默认情况下sqrt(vi) ~ yi似乎有效:
# ...
funnel(res, level=c(90, 95, 99), shade=c("white", "gray", "darkgray"), refline=0)
text(res$yi,sqrt(res$vi)+.016,res$slab,cex=.8)
Run Code Online (Sandbox Code Playgroud)
有时,图形外观当然可能会很糟糕,因为重叠的标签变得不可读。
或者,您可以尝试自己分配有意义的pch- 值(通常应该是整数),并尝试用图例来解释这些值:
alloc.factor <- factor(dat.bcg$alloc)
stopifnot(res$k==length(alloc.factor))
funnel(res, level=c(90, 95, 99), shade=c("white", "gray", "darkgray"), refline=0,
pch=as.numeric(alloc.factor),lwd=2,cex=1.6)
legend("topright",levels(alloc.factor),pch=1:3,pt.lwd=2,cex=1.6)
Run Code Online (Sandbox Code Playgroud)