[R] shaded area graph and extra plot

From: Luis Ridao Cruz <Luisr_at_frs.fo>
Date: Thu, 14 Feb 2008 09:02:27 +0000


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_at_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. Received on Thu 14 Feb 2008 - 09:10:21 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 14 Feb 2008 - 09:30:14 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive