[R] Multiple plots on multiple devices

Prof Brian Ripley ripley at stats.ox.ac.uk
Mon Nov 3 18:03:04 CET 2008


On Mon, 3 Nov 2008, Oliver Kimberlin wrote:

> Hi List,
>
> This is possibly a newbie error. I have however searched long and hard
> and haven't found a solution.
>
> I am attempting to plot multiple lattice graphs in R, plotting 4 per
> page and moving on to a new device to plot the next 4 and so on. (I want
> to do this in R and not export to a pdf etc)
>
> I notice that in S-PLUS multiple tabs are opened in one device, R does
> not seem to have this capability and as I plot the next 4 graphs they
> overwrite the previous 4.

Well, on Windows there is a history mechanism that has the same effect as 
tabs.  You haven't told us your OS (nor the screen device).

>
> I imagine a 'for' loop could solve this by opening a new active device
> at the end of the loop, but I feel this is inefficient and that there
> must be a solution by modifying the lattice object.
>
> Let z be a lattice object. (histogram for example)
>
> Let the layout be.
>
> layout=cbind(c(1,2),c(3,4))
>
>     [,1] [,2]
>
> [1,]    1    3
>
> [2,]    2    4
>
> Print(z)
>
> Thus giving 4 graphs per page on multiple pages until the lattice object
> has been completely plotted.
>
> I hope this is clear
>
> Thanks all
>
> Oli
>
>
>
>
>
>
>
>
>
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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.
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-help mailing list