地块之间的箭头

时间:2017-03-06 11:47:11

标签: r plot arrows

我想在R上直接在R上添加一些箭头,如图中的箭头所示:

enter image description here

到目前为止,我只有下面代码的图,但我无法弄清楚如何添加箭头

# devtools::install_github("franciscorichter/dmea")
library(dmea)

s = sim_phyl()
par(mfrow=(c(1,2))) # 1 row but 2 plot panels
color = 'darkgreen'
plot(s$newick,direction = 'upwards',show.tip.label=FALSE,edge.width=5,edge.color = color,type="fan", no.margin = TRUE)
dropex <- drop.fossil(s$newick) 
plot(dropex,direction = 'upwards',show.tip.label=FALSE,edge.width=5,edge.color = color,type="fan", no.margin = TRUE)

1 个答案:

答案 0 :(得分:0)

以下是使用par(mfrow=))对3列进行此操作的一种方法。如果您希望更好地控制列宽,请考虑使用layout代替par(mfrow=))

par(mfrow=(c(1,3))) # 1 row but 3 plot panels
plot(1:10, yaxt="n",ylab="")
plot(1:10,type="n", yaxt="n",xaxt="n",xlab="", ylab="", bty="n")
arrows(x0=10, y0=7, x1 = 1, y1 = 7)
arrows(x0=1, y0=3, x1 = 10, y1 = 3)
plot(10:1, yaxt="n",ylab="")

enter image description here