[R] lattice: limits in reversed order with relation="same"

Thaler, Thorn, LAUSANNE, Applied Mathematics Thorn.Thaler at rdls.nestle.com
Mon Aug 30 12:27:23 CEST 2010

Hi everybody,

I want an x-axis which has xlim=c(max, min) rather than xlim=c(min, max)
in order to reflect the type of the process (cooling):

myprepanel <- function(x,y,...) list(xlim=rev(range(x)))
x <- rep(1:10, 100)
z <- factor(sample(10, 1000, T))
y <- rnorm(1000, x, as.numeric(z))

xyplot(y~x|z, scales=list(x="free"), prepanel=myprepanel)

This works as expected. But I don't like to have the x-axis annotation
in every panel since in fact it is the same in every panel. Doing the
same with relation="same" does not work, however. From "Lattice -
Multivariate Data Visualization with R" p.142:

"Note that this will not work when relation="same", because in that case
the process of combining limits from different packets makes the final
limit sorted [...]"

So which part do I have to change to get a multipanel plot with x-axis
in reversed order but where the x-axes are only drawn in the panels at
the boundary (like in xyplot(y~x|z))? Do I have to provide an own axis

Any help appreciated.



More information about the R-help mailing list