[R] Trellis - setting xlim or ylim by data range in whole column or row
Keith Chamberlain
Keith.Chamberlain at colorado.edu
Thu Mar 9 23:29:19 CET 2006
Dear List-mates,
I have been trying to set up a 4x8 trellis plot (that is, 4 columns, 8
rows), and would like to have the axis limits set based on the data range of
rows (for ylim) and columns (for xlim). I've been using the call:
foo<-xyplot(y~x|Epoch+Subject,
type=c("l","r"),
par.strip.text=list(cex=0.5),
...)
and updating to see different effects of scale adjustments, & etc.
foo<-update(foo, scale=list(relation="sliced")) #etc.
I can have each panel with its own limits using relation="free", limits wide
enough to accommodate the whole data range with "same" or the limits of the
widest panel for all panels with "split". I have not, however, figured out a
way to have the limits for x & y grouped by their column or row.
Documentation points to 3 alternate ways of trying to set stuff in panels.
(1) a prepanel function, (2) using scales, or (3) focusing in on each panel
individually & changing some setting.
I've played around with accessing different panels individually with
foo[column, row], and using a list to determine which get displayed (instead
of using skip because I can't get skip to work). Would I be able to set the
xlim values in a similar way?
foo[1,]$ylim<-newvalues to set a whole columns ylims (e.g by data range of
y in conditioning variable 2 (subject in my case)) and
foo[,1]$xlim<-newvalues
to get a whole rows xlims by the data range of x in each level of
conditioning variable 1 (Epoch in my formula))? If so, what attribute should
I access, and if not what would you recommend?
I've been reading posts, working examples in Venables & Ripley 4th Ed., and
experimenting with different things for the last 4 days. I'm still not used
to the lattice terminology, so I could have easily miss interpreted what
something was meant for (example- prepanel makes no sense to me yet).
Conversely, I got a lot farther, a lot faster, using Lattice than I did
using plot or ts.plot. In addition to a much shorter list of attributes that
don't make sense to me yet than otherwise, I have been really tickled with
the Lattice package.
Thanks in advance for your feedback.
KeithC.
More information about the R-help
mailing list