Permanent changes: the <tt>par()</tt> function



next up previous contents
Next: Temporary changes: arguments Up: Using graphics parameters Previous: Using graphics parameters

Permanent changes: the par() function

The par() function is used to access and modify the list of graphics parameters for the current graphics device.


par()
Without arguments, returns a list of all graphics parameters and their values for the current device.
par(c("col", "lty"))
With a character vector argument, returns only the named graphics parameters (again, as a list.)
par(col=4,lty=2)
With named arguments (or a single list argument) , sets the values of the named graphics parameters, and returns the original values of the parameters as a list.

Setting graphics parameters with the par() function changes the value of the parameters permanently, in the sense that all future calls to graphics functions (on the current device) will be affected by the new value. You can think of setting graphics parameters in this way as setting `default' values for the parameters, which will be used by all graphics functions unless an alternative value is given.

Note that calls to par() always affect the global values of graphics parameters, even when par() is called from within a function. This is often undesirable behaviour - usually we want to set some graphics parameters, do some plotting, and then restore the original values so as not to affect the user's S session. You can restore the initial values by saving the result of par() when making changes, and restoring the initial values when plotting is complete.

oldpar <- par(col=4,lty=2)

...plotting commands ...

par(oldpar)



Erik Moledor
Tue Jan 31 21:02:18 EST 1995