[R] lattice cloud and conditional axis limits

Karl Ove Hufthammer karloh at mi.uib.no
Tue Sep 12 14:30:45 CEST 2006


I'm using the 'cloud' function in the 'lattice' package to produce
multi-panel 3D scatter plots. The range of the values used vary much
between each panel (especially on the z axis), so I wish the axis limits
to be calculated based on the (conditional) data.

Here's a minimal example:

library(lattice)
z=1:200
x=runif(200)
y=runif(200)
s=factor(rep(c(1,2),each=100))
cloud(z~x*y|s,scales=list(arrows=FALSE))

On the first panel, the z values are in the range [1,100], and on the second
panel, they are in the range [101,200]. I wish the z axis to reflect this,
i.e., to only span these values. (In my actual data sets, this does make
more sense than in this example.) If 'cloud' worked the same way the
'xypanel' function does, one of the following would work:

cloud(z~x*y|s,scales=list(arrows=FALSE,z=list(relation="free")))
cloud(z~x*y|s,scales=list(arrows=FALSE,relation="free"))

However, it does not. Any ideas how I can make it work?

-- 
Karl Ove Hufthammer
E-mail and Jabber: karl at huftis.org



More information about the R-help mailing list