Extracting specified pages from a lattice ("trellis") object.

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Extracting specified pages from a lattice ("trellis") object.

Rolf Turner

Suppose that (e.g.) xyplot() returns an object "xxx" with (say) 3 pages.
I would like to extract/plot (print) just one of these pages, e.g.
page 2.

Here's a toy example:

x   <- rep(seq(0,1,length=11),12)
set.seed(42)
y   <- rnorm(3*44)
a   <- rep(letters[1:12],each=11)
dta <- data.frame(x=x,y=y,a=a)
xxx <- xyplot(y~x|a,data=dta,layout=c(2,2))

I would to extract from xxx and print page 2 (the page corresponding to
levels e, f, g and h).

Is there any (simple) way that I can do this?

I've mucked around with update.trellis() and [.trellis, but I cannot
make head nor tail of the documentation.  The [.trellis method seems to
work in some situations, but not in others, and since I cannot
understand what it actually does, I cannot figure out why.

E.g. in my toy example "xxx[5:8]" seems to give me what I want, but in
the context of my real application a similar construction does not work.

Thanks for any insight.

cheers,

Rolf Turner

--
Technical Editor ANZJS
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.