Desktop Survival Guide
by Graham Williams

Multiple Plots

On any device, a sequence of graphics may be produced. For a screen device, for example, each call of the plot function will effectively wipe the active screen device and start drawing a new graphic. Multiple plots to the same device, without wiping the screen, can be achieved by setting the Roption[]new option to true for each plot:

> plot(a)
> par(new=TRUE)
> plot(b)
> par(new=TRUE)
> plot(c)

On a MS/Windows device there is the opportunity to interactively cycle through the sequence of graphics, after turning on the Recording option of the History menu of the graphics Window. You can then use the Page Up and Page Down keys (or the menu) to cycle through the sequence of graphics. This is not available on the X11 screen device under Unix and GNU/Linux.

When displaying on a file device, multiple plots equate to multiple pages. Some file devices, such as postscript and pdf support multiple pages. Many print devices support the production of multiple files for multiple plots, through setting onefile=FALSE and the file name to something like file="plot%03d".

Copyright © 2004-2010 Togaware Pty Ltd
Support further development through the purchase of the PDF version of the book.
The PDF version is a formatted comprehensive draft book (with over 800 pages).
Brought to you by Togaware. This page generated: Sunday, 22 August 2010