Dear Deepayan,

Thanks for getting back to me. In the interim, I computed the layout that I 
wanted in the more complicated context in which the problem arose, but I'll 
certainly keep this clever idea in mind. 

Regards,
 John

------------------------------
John Fox, Professor
Department of Sociology
McMaster University
Hamilton, Ontario, Canada
web: socserv.mcmaster.ca/jfox


> -----Original Message-----
> From: Deepayan Sarkar [mailto:[EMAIL PROTECTED]
> Sent: September-25-08 6:15 PM
> To: John Fox
> Cc: r-help@r-project.org
> Subject: Re: [R] restricting lattice pages to one
> 
> On Thu, Sep 25, 2008 at 7:33 AM, John Fox <[EMAIL PROTECTED]> wrote:
> > Dear list members,
> >
> > I'd like to be able to restrict the number of pages in a lattice display to
> > one without having to specify explicity the number of rows and columns in
> > the display -- that is, having forced one page, I'd like the number of rows
> > and columns to be determined automatically.
> >
> > For example, the following code produces two pages of output, with the
> > second replacing the first on the trellis device:
> >
> >  A <- factor(rep(c("a1", "a2"), c(20, 20)))
> >  B <- factor(rep(rep(c("b1", "b2"), c(10, 10)), 2))
> >  C <- factor(rep(rep(c("c1", "c2"), c(5, 5)), 4))
> >  X <- rnorm(40)
> >  Y <- X + 0.2*rnorm(40)
> >  trellis.device()
> >  xyplot(Y ~ X | A + B + C)
> >
> > I can get what I want via
> >
> >  xyplot(Y ~ X | A + B + C, layout=c(4, 2, 1))
> >
> > but in the application I have in mind, I'd like to avoid having to compute
> > the rows and columns.
> 
> A general (but two-step) solution is
> 
> p = xyplot(Y ~ X | A + B + C)
> update(p, layout = c(0, prod(dim(p))))
> 
> Another solution that is effectively the same (with different strip
> annotation) is to use an interaction as the single conditioning
> variable.
> 
> xyplot(Y ~ X | A:B:C)
> 
> -Deepayan

______________________________________________
R-help@r-project.org 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.

Reply via email to