[R] finer control of scales in xyplot

From: Benjamin Tyner <btyner_at_stat.purdue.edu>
Date: Mon 08 Jan 2007 - 19:41:09 GMT


When plotting over multiple pages in lattice, I'd like to be able to have "same" scales within a page, but "free" scales between pages. In other words, something like:

z<-data.frame(x=1:100,
              y=runif(100),
              d=rep(1:2,50),
              p=rep(1:2,each=50))

plot<-xyplot(y~x|d*p,
             data=z,
             scales=list(x=list(relation="free")),
             layout=c(1,2))
            

but within a page, to have common x-axes. As long as 'x' is sorted, I can get the desired effect by transforming x to a relative scale:

plot<-xyplot(y~unlist(with(z,tapply(x,p,function(x) (x-min(x))/diff(range(x)))))|d*p,

             data=z,
             layout=c(1,2))

except that I'd like the tickmark labels to be in the original units of 'x'. I've started looking at xscale.components.default to see whether it can work on a per-page (instead of per-panel) basis, but I get the nagging suspicion that I'm making this harder than it needs to be. Any assistance greatly appreciated.

Thanks,
Ben



R-help@stat.math.ethz.ch 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 Jan 09 23:44:10 2007

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Tue 09 Jan 2007 - 13:30:34 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.