[Rd] Wish: Option to configure the default par() (PR#9545)

thomas.friedrichsmeier at ruhr-uni-bochum.de thomas.friedrichsmeier at ruhr-uni-bochum.de
Tue Mar 6 15:03:38 CET 2007

Full_Name: Thomas Friedrichsmeier
Version: 2.4.1
OS: linux (Debian unstable)
Submission from: (NULL) (

Summary: It would be nice to have a centralized option for setting default par()
options for all devices and all plots. This would ease producing graphs in a
customized but consistent way. Suggesting options("par.default").

Example problem: Make all graphs look like

par(bg="light gray", las=2)

both on screen and for various produced file formats such as png() and

Current situation: To solve the example problem, two approaches come to mind:
1) Always call par() before the next plot. This could be wrapped into a function
to make it easier to stay consistent. E.g.:

myDefaultPar()       # calls par(bg="light gray", las=2)

2) Create wrappers for all devices of interest, like e.g. (not quite correct,
but good enough for this example):

myX11 <- function(...) {
  par(bg="light gray", las=2)

Both solutions work, but are not entirely elegant. The drawback of 1) is that
you still need to add the given line manually at all places. The drawback of 2)
is that a similar wrapper will have to be created (and used) for each different

Add a new option: options("par.default"), similar to the existing
options("par.ask.default"). This option would accept a list of all par settings
to set a custom default for:

options(par.default=list(bg="light gray", las=2))

par() options specified while creating the device, in calls to plot() or in
subsequent calls to par() would take precendence over options("par.default").

More information about the R-devel mailing list