如何用双向CI图线连接方式?

时间:2018-12-20 17:11:53

标签: r

如何在上述两种CI图中用线连接方式?对于下面  链接示例。

Plot with two Y axes : confidence intervals

1 个答案:

答案 0 :(得分:0)

在底数R中使用lines绘制线。它不会重新开始绘图。

library(plotrix)

set.seed(1234)    # In the linked to question 
                  # the rsults were not reproducible

x <- 1:10
y1 <- x + rnorm(10)
y2<-x+rnorm(10)
delta <- runif(10)

plotCI(x,y=y1,uiw=delta,xaxt="n",gap=0)
axis(side=1,at=c(1:10),labels=rep("a",10),cex=0.7)
lines(x, y = y1 + delta, lty = "dotted")
lines(x, y = y1 - delta, lty = "dotted")

enter image description here