R-help, I'm using the code below to plot a shaded area graph.
At the same time I want to plot a second series on the y-axis (from par(new=T) on) but as the two series have different x-axis range (first 1994:2007 and second 1996:2007) the corresponding x's do not match. How can this be sorted out? Thanks in advance ############################################# plot.new() plot.window(xlim=c(1993,2008), xaxs="i", ylim=c(0,400), yaxs="i") x=1994:2007 xx = c(1994, x, 2007) yy1 = c(0, indexSp[,"Xhat5Sp"]+indexSp[,"seA"], 0 ) yy2 = c(0, indexSp[,"Xhat5Sp"]-indexSp[,"seA"], 0 ) polygon(xx, yy1, col="grey", lty=0) polygon(xx, yy2, col="white", lty=0) lines(x, indexSp[,"Xhat5Sp"], type="l") axis(1) axis(2) par(new=T) plot(1996:2007, c(0,0,indexSu[,"Xhat5Su"]), type="p", col=2, lwd=2, cex=1,ann=T,axes=F) axis(4) ############################################# ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.