首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何向森林地块添加箭头?

如何向森林地块添加箭头?
EN

Stack Overflow用户
提问于 2014-11-03 18:32:05
回答 1查看 2K关注 0票数 2

我会在一片森林中加两支箭,作为一份去日记的论文。下面是metafor::forest的演示图

代码语言:javascript
复制
require(metafor)
data(dat.bcg)
res <- rma(measure="RR", ai=tpos, bi=tneg, ci=cpos, di=cneg, data=dat.bcg,
           slab=paste(author, year, sep=", "))
forest(res, cex=.8, order=order(dat.bcg$ablat), addfit=F)

我想要的是沿着x轴添加两个箭头,比如(在红色方框中):

有人知道怎么做吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-11-03 19:26:47

一种方法是使用layout将绘图分成2部分,并将x轴标签替换为新的绘图。

代码语言:javascript
复制
## define the layout matrix  
## 2 rows and 3 columns , the rectangle will be in the cell(2,2)
layout(matrix(c(1,1,1,0,2,0), 2, 3, byrow = TRUE),
       heights=c(3,1),widths=c(1,2,1))
## define the margin since the default ones are usually not enough
par(mar = rep(2, 4))

## your plot here 
data(dat.bcg)
res <- rma(measure="RR", ai=tpos, bi=tneg, ci=cpos, di=cneg, data=dat.bcg,
           slab=paste(author, year, sep=", "))
forest(res, cex=.8, order=order(dat.bcg$ablat), addfit=F,xlab='')

## here all the job 
x <- y <- 2:8 
## dummy plot to define scales
plot(x,y,type='n',axes=F,xlab='',ylab='')
## rectangle
rect(2,4,8,8,border='red')
## arrows
arrows(5.5,6,7,6)
arrows(4.5,6,3,6)
text(6,6,'A better',adj=c(0,1.5),col='blue')
text(3.5,6,'B better',adj=c(0,1.5),col='green')
## x label
text(5,3,'Risk Difference',cex=2)
票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/26720663

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档