[R] lattice/ grid.layout/ multiple graphs per page

Deepayan Sarkar deepayan.sarkar at gmail.com
Mon Aug 1 03:11:20 CEST 2005


On 7/28/05, McClatchie, Sam (PIRSA-SARDI)
<mcclatchie.sam at saugov.sa.gov.au> wrote:
> Background:
> OS: Linux Mandrake 10.1
> release: R 2.0.0
> editor: GNU Emacs 21.3.2
> front-end: ESS 5.2.3
> ---------------------------------
> 
> >-----Original Message-----
> >From: Deepayan Sarkar [mailto:deepayan.sarkar at gmail.com]
> >Sent: Friday, 29 July 2005 3:44 AM
> >To: McClatchie, Sam (PIRSA-SARDI)
> >Cc: R-Help-Request (E-mail)
> >Subject: Re: [R] lattice/ grid.layout/ multiple graphs per page
> 
> >Depends on the details of your 'working trellis code'. Are you using
> >print() explicitly with 'newpage=FALSE'? See ?print.trellis for
> >details.
> >
> >Deepayan
> 
> -------------------------
> Sorry Deepayan, I should have included the full code originally.
> Here it is, with your suggestion for using the newpage=FALSE option to
> print(). I still have not got it right.


Your code is not reproducible (but full of irrelevant details).
All the grid layout stuff is commented out, so I am not sure what
you expect this code to do.

Anyway, you are probably missing some upViewport / popViewport
calls, since the following does what I would expect:



library(lattice)
library(grid)

p <- xyplot(1 ~ 1)

grid.newpage()
pushViewport(viewport(layout = grid.layout(2, 2)))

pushViewport(viewport(layout.pos.col=1, layout.pos.row=1))
print(p, newpage = FALSE)
popViewport(1)

pushViewport(viewport(layout.pos.col=2, layout.pos.row=2))
print(p, newpage = FALSE)
popViewport()




More information about the R-help mailing list