ploptions {plgraphics}R Documentation

Set and Get User "Session" Options that influence "regr0"s behavior

Description

The user can set (and get) options – mostly graphical "parameters" – which influence the behavior plgraphics functions.

Usage

ploptions(x = NULL, list = NULL, default = NULL, ploptions = NULL,
          assign = TRUE, setpar = FALSE, ...)


.ploptions
ploptionsDefault

Arguments

x

character (vector) of name(s) of ploptions to query. If x is set, all further arguments will be ignored.

list

a named list of options to be set, see Details

default

character vector of option names. These ploptions will be set according to ploptionsDefault. default="all" or =TRUE will reset all options. If default is set, all further arguments will be ignored.

ploptions

the list of options that should be modified

assign

logical: should the list be assigned to .ploptions?

setpar

logical: should the 'margin parameters' ("mar","oma","mgp","cex") be set permanently by calling par? If FALSE, these options will only be active while using pl functions.

...

any ploptions can be defined or modified, using name = value, as in options of basic R.

Details

If the argument list is set, it must be a named list, and each component, with name name and value value is used as described for arguments in ..., see above (in addition to such arguments).

Here is a list of the components of ploptionsDefault, describing the suitable alternative values to be set by calling ploptions:
incomplete for the time being!!!

Value

For ploptions(x), where x is the name of a pl option, the current value of the option. or NULL if it is not such a name. If x contains several (valid) names, the respective list.

For ploptions(), the list of all plptions sorted by name.

For uses setting one or more options, the important effect is a changed list .ploptions that is used by the packages functions (if assign is TRUE). The (invisibly) returned value is the same list, complemented by an attribute "old" containing the previous values of those options that have been changed. This list is useful for undoing the changes, usually at the end of graphical functions, to restore the previous status.

.ploptions and ploptionsDefault are lists of options. The first one is generated whenever ploptions are set (and assign is TRUE), and is then stored in the ".GlobalEnv" environment. The second is stored in the package plgraphics.

Note

In contrast to the options of R base, the .plptions list is stored in the .GlobalEnv (if any component is changed) and will be recovered if the latter is stored and loaded again.

Author(s)

Werner A. Stahel

See Also

stamp; R's own predefined options().

Examples

## see example(stamp)
ploptions("stamp")
ploptions(c("jitterFactor", "gridlines"))

## set options
ploptions(stamp=FALSE, pch=0, col=c.colors[-1], anything="do what you want")
ploptions(c("stamp", "anything"))
ploptions(default=TRUE)
t.plopt <- ploptions(smooth.col="green", assign=FALSE)
t.plopt$smooth.col
ploptions("smooth.col") ## unchanged

## setting 'margin parameters' mar, oma, mgp, cex : 
ploptions(mar=c(2,2,1,1))  ## only active in pl funcions
  ## (unless  ploptions("keeppar")  is  FALSE )
ploptions(mar=c(2,2,1,1), setpar=TRUE)  ## changes the margins permanently
ploptions(setpar=TRUE) ## does the same. All the margin pars are
  ## set permanently to the values in  .ploptions

## switching 'margin parameters' between those used
## outside and inside high level pl functions
par(mar=c(2,2,5,2))
plyx(Sepal.Width~Sepal.Length, data=iris)
par("mar")
mtext("wrong place for text",3,1, col="red")
t.plo <- plmarginpar()
par("mar")
mtext("here is the right place",3,1)

par(attr(t.plo, "oldpar"))  ## resets the 'margin parameters'
par("mar")
plyx(Sepal.Width~Sepal.Length, data=iris, keeppar=TRUE)
par("mar")

[Package plgraphics version 1.1 Index]