[R] multipanel display of levelplots?
Deepayan Sarkar
deepayan at stat.wisc.edu
Mon Apr 26 16:51:30 CEST 2004
On Sunday 25 April 2004 03:51, Yan Wang wrote:
> I cannot achieve a multipanel display of several levelplots. Here is
> part of my code.
>
> At first, create the layout:
> push.viewport(viewport(layout=grid.layout(1, 2)))
>
> Then for the left panel:
> push.viewport(viewport(layout.pos.col=1,layout.pos.row=1))
> push.viewport(viewport(width=0.6, height=0.6))
> levelplot(z~x*y, grid)
> pop.viewport()
>
> Similar code for the right panel.
>
> However, there is always error message for "pop.viewport()" as "Error
> in pop.vp(i == n, recording) : Illegal to pop top-level viewport". If
> I omit "pop.viewport()", the two levelplots were printed on seperate
> pages without a layout of (1,2).
>
> Any suggestion is greatly appreciated.
I'm not sure what you are trying to do here. If you want multipanel
levelplot displays in the Trellis sense, this is not the way to do it,
see example(levelplot). If for some reason you want trellis plots in
grid viewports, then you will have to tell the print method not to
start a new page, by replacing
levelplot(z~x*y, grid)
with
print(levelplot(z~x*y, grid), newpage = FALSE)
push.viewport etc are deprecated, BTW.
Deepayan
More information about the R-help
mailing list