Try this:

library(zoo)
# ignore the fact that months have different lengths
z <- with(airquality, zoo(cbind(Wind, Temp), Month + (Day - 1)/31))
plot(z) # each on separate plot stacked above each other
plot(z, screen = 1) # both on same plot

library(lattice)
xyplot(z)
xyplot(z, screen = 1)

?plot.zoo has examples of using two y axes on the same plot


On Tue, Aug 4, 2009 at 5:33 PM, Jason Rupert<jasonkrup...@yahoo.com> wrote:
> Is there a place that shows how to create two plots that are stacked on top 
> of each other where they share a common x-axis scale, but have differnt 
> y-axis scale?
>
> Say have the following data: airquality
> Stack plot(airquality$Day, airquality$Wind) on top of  plot(airquality$Day, 
> airquality$Temp).
>
> I am interested in stacking the two on top of each other with no seam, or 
> plotting the two lines with two different y-axis scales on the same plot.
>
> Thanks for any feedback and insights.
>
> ______________________________________________
> 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.
>

______________________________________________
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.

Reply via email to