pl.control: Arguments for plotting functions

pl.controlR Documentation

Arguments for plotting functions

Description

Arguments that can be specified calling plyx and other 'pl' functions are checked and data is prepared for plotting.

Usage

pl.control(x=NULL, y=NULL, condvar = NULL, data = NULL, subset = NULL,
  transformed = TRUE, distinguishy = TRUE, gensequence = NULL,
  csize = NULL, csize.pch = NULL, 
  psize = NULL, plab = FALSE, pch = NULL, pcol = NULL,  
  smooth.weights = NULL, smooth.weight = NULL,
  markextremes = NULL, smooth = NULL,
  xlab = NULL, ylab = NULL, varlabel = NULL,
  vcol = NULL, vlty = NULL, vpch = NULL, plscale = NULL, log = NULL,
  main = NULL, sub = NULL, .subdefault = NULL, mar = NULL, 
  gencoord = TRUE,
  plargs = pl.envir, ploptions = NULL, .environment. = parent.frame(),
  assign = TRUE, ... )

Arguments

x, y, data

as in plyx

condvar

conditioning variables for plcond

subset

subset of data.frame 'data' to be used for plotting. See details.

transformed

logical: should transformed variables be used?

distinguishy

logical: should multiple y's be distinguished? This is TRUE if pl.control is called from plyx.

gensequence

logical: if only x or only y is set, should the other of these be specified as the sequence 1:nobs (where nobs is the number of observations)?

csize

character expansion, applied to both labels and plotting characters.

csize.pch

expansion of plotting symbol relative to par("pch"). By default, it adjusts to the number of observations.

psize, plab, pch, pcol

Plotting characteristics of points, specified as a (unquoted) variable name found in data or as a vector. They set the size of the plotting symbols, labels (character strings), plotting character, and color, respectively.
plabs = TRUE asks for using the row names of data.

smooth.weights, smooth.weight

weights to be used in calculating smooth lines. Both are equivalent.

markextremes

scalar: proportion of extreme points to be labelled

smooth

logical: should a smooth line be added?

xlab, ylab

axis labels

varlabel

labels for variables replacing their names in the x and y arguments, either a simple vector of strings with an element for each variable, or a named vector, where names correspond to such variables.

vcol, vlty, vpch

color, line type and plotting character to be used when multiple y-s are plotted (in the sense of matplot)

plscale

plot scale: name of the function to be used for generating a plotting scale, like "log". A named character vector can be given, where the names correspond to variable names in data.

log

requires log scale as in R's basic plot function, e.g., equals either "x", "y" or "xy"

main, sub

string. Main title of the plot(s). If sub starts by ":" (the default), pl.control tries to generate an informative subtitle, determined by the data or a model formula.

.subdefault

for internal use: default of subtitle

mar

plot margins

gencoord

logical: should plotting coordinates be generated? This is avoided for low level pl graphics.

plargs

pl arguments, a list with components ploptions, see the following argument; pldata, the data used for plotting; pmarpar, graphical parameters defining margins.

ploptions

Plotting attributes, e.g., plotting character, line types, colors and the like, for different aspects of plots. Result of ploptions. Defaults to pl.envir$ploptions.

.environment.

used by the calling function to provide the environment for evaluating x and y

assign

logical: should the result of pl.control be assigned to the pl.envir environment? This will be done for high level pl functions, but avoided for low level ones. It allows for reusing the settings and helps debug unexpected behavior.

...

further arguments. These may include:

psize, plab, pch, pcol, group, smooth.group, smooth.weights:

these specify graphical elements for each observation (row of data). the respective columns are added to the pldata data.frame.

...:

further ... arguments will be passed on to ploptions. The respective settings will be used in the calling pl function, but not permanently stored in ploptions in the pl.envir environment.

Details

The function selects the data according to the arguments x, y, data and subset (the latter by calling plsubset). The argument subset should be used instead of data[subset,] if the dataset data contains variable attributes like varlabel, ticksat, .... The argument is evaluated in the dataset defined by data, i.e., variable names may be used to define the subset.

Value

A list containing all the arguments, possibly in modified form. Specifically, the evaluations of the variables contained in x and y along with psize, plab, pch, pcol, smoothGroup, smoothWeights are collected in the component pldata. The component, ploptions, collects the ploptions, and plfeatures contains a list of additional features, both to be used in the calling high level pl function

Author(s)

Werner A. Stahel

See Also

plyx, plmatrix, ploptions

Examples

plyx(Sepal.Width~Sepal.Length, data=iris, axp=7, plab=TRUE, csize.plab=0.6)
## same as
plargs <- pl.control(Sepal.Width~Sepal.Length, data=iris)
plargs$pdata$plab <- row.names(iris)
plargs$csize.lab <- 0.6
plargs$axp <- 7
plyx(Sepal.Width~Sepal.Length, plargs=plargs)


plgraphics documentation built on Oct. 19, 2023, 3 p.m.