【发布时间】:2015-11-17 15:24:37
【问题描述】:
当存在 y 轴中断时,我正在尝试将置信区间添加到使用 plotrix 包制作的 gap.plot 中。这是一个 MWE:
twogrp=c(rnorm(5)+4,rnorm(5)+20,rnorm(5)+5,rnorm(5)+22)
gap.plot(twogrp,gap=c(8,16),
xlab="X values",ylab="Y values",xlim=c(1,30),ylim=c(0,25),
main="Test two gap plot with the lot",xtics=seq(0,25,by=5),
ytics=c(4,6,18,20,22,24),
lty=c(rep(1,10),rep(2,10)),
pch=c(rep(2,10),rep(3,10)),
col=c(rep(2,10),rep(3,10)),
type="b")
arrows(2,18,2,24,length=0.05,angle=90,code=3)
这并没有添加箭头,大概是因为上面的绘图区域已经被关闭了。
这可行:
gap.plot(twogrp,gap=c(8,16),
xlab="X values",ylab="Y values",xlim=c(1,30),ylim=c(0,25),
main="Test two gap plot with the lot",xtics=seq(0,25,by=5),
ytics=c(4,6,18,20,22,24),
lty=c(rep(1,10),rep(2,10)),
pch=c(rep(2,10),rep(3,10)),
col=c(rep(2,10),rep(3,10)),
type="b")
arrows(2,4,2,6,length=0.05,angle=90,code=3)
任何人都知道不涉及使用另一个包的解决方法。我知道如何在 ggplot2 中执行此操作,我只是更喜欢使用 plotrix。
【问题讨论】: