Re: [R] shaded area graph and extra plot

From: jim holtman <jholtman_at_gmail.com>
Date: Tue, 12 Feb 2008 11:27:26 -0500

Use 'xlim=c(1993,2008)' in your second plot to setup the same range.

On Feb 12, 2008 10:39 AM, Luis Ridao Cruz <Luisr_at_frs.fo> wrote:
> 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.
>

-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

______________________________________________
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 Tue 12 Feb 2008 - 16:33:33 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 Tue 12 Feb 2008 - 17:30:13 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