several plots in one

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

several plots in one

jeebee-2
Can anyone tell me how I can supply more than one graph to plotCI
(gplots) at once?

Below is what I tried, also with rbind instead of cbind.
What is the way to do this (in general, I think)?

Problem is that lines of 1-st and 2-nd series are mixed, while they have
nothing to do with each other.

I also tried calling plotCI with argument add=TRUE, which didn't seem to
work (that is actually what I wanted I think).
(It should look the same as if I called plotCI twice with same
labels/xlim/ylim/etc.)

  plotCI(x = cbind(x1,x2),
         y = cbind(means1,means2), # means1 == ci1["Estimate",]
         xlim = c(0,100), #ylim = c(0.2,0.5),
         ylab = "System welfare",
         pch = 7, col = c("red","blue"), type = "b",
         uiw = cbind(uiw1,uiw2))

Thanks in advance,
JeeBee.

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: several plots in one

Warnes, Gregory R
If you want two series of plotted confidence intervals, first plot one series using plotCI with the standard arguments, then call plotCI a second time with add=TRUE.  For example:


       data(state)
       tmp   <- split(state.area, state.region)
       means <- sapply(tmp, mean)
       stdev <- sqrt(sapply(tmp, var))
       n     <- sapply(tmp,length)
       ciw   <- qt(0.975, n) * stdev / sqrt(n)

       # First series
       plotCI(x=means, uiw=ciw)

         # Second series
       plotCI(x=means+1e5, uiw=ciw, add=T)


Note that you may need to manually specify xlim and ylim to ensure that the second series fits on the plot.

-Greg

> -----Original Message-----
> From: [hidden email]
> [mailto:[hidden email]]On Behalf Of JeeBee
> Sent: Wednesday, February 01, 2006 6:02 AM
> To: [hidden email]
> Subject: [R] several plots in one
>
>
> Can anyone tell me how I can supply more than one graph to plotCI
> (gplots) at once?
>
> Below is what I tried, also with rbind instead of cbind.
> What is the way to do this (in general, I think)?
>
> Problem is that lines of 1-st and 2-nd series are mixed,
> while they have
> nothing to do with each other.
>
> I also tried calling plotCI with argument add=TRUE, which
> didn't seem to
> work (that is actually what I wanted I think).
> (It should look the same as if I called plotCI twice with same
> labels/xlim/ylim/etc.)
>
>   plotCI(x = cbind(x1,x2),
>          y = cbind(means1,means2), # means1 == ci1["Estimate",]
>          xlim = c(0,100), #ylim = c(0.2,0.5),
>          ylab = "System welfare",
>          pch = 7, col = c("red","blue"), type = "b",
>          uiw = cbind(uiw1,uiw2))
>
> Thanks in advance,
> JeeBee.
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html
----------------------------------------------------------------------
LEGAL NOTICE\ Unless expressly stated otherwise, this messag...{{dropped}}

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html