Desktop Survival Guide
by Graham Williams

Graphics Parameters

The par function in R applies various options to the current graphics device. It can not be set until the device has been created. It is used to change or add to the appearance of a plot, or to obtain information about a plot. For example, the Roption[]usr option returns the coordinates of the plotting region:

> plot(rnorm(50))
> par("usr")
[1] -0.960000 51.960000 -3.245599  2.852000

This is useful when you want to place additional objects on the plot--it will tell you the extent of the coordinates currently in use.

When using the lattice package note that instead of par we use trellis.par.get and trellis.par, as in:

> library(lattice)
> mt <- trellis.par.get("par.main.text")
> mt$cex <- 0.7
> trellis.par.set("par.main.text", mt)

The output of trellis.par.get without arguments lists all the possible options. Calling show.settings can also help.


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