genvarattributes
generates attributes of variables that are
useful for the plgraphics
functions.
It is called by pl.control
.
setvarattributes
modifies or sets such attributes.
genvarattributes(data, vnames = NULL, vcol = NULL, vlty = NULL, vpch = NULL,
varlabel = NULL, innerrange = NULL, plscale = NULL, zeroline = NULL,
replace=FALSE, ploptions = NULL, ...)setvarattributes(data, attributes = NULL, list = NULL, ...)
Data.frame, returning the original values, but the variables are
supplemented by the following attributes
, where available:
number of distinct values
inner plotting range
plotting coordinates
tick marks for axis
label to be used as axis label
value(s) for which a horizontal or vertical line will be drawn (in addition to the gridlines)
data.frame consisting of the variables (columns) to be characterized by their attributes
names of variables to be treated as y variables
color, line type and plotting character
to be used when multiple y-s are plotted (in the sense of
matplot
)
labels of the variables, in the case that the
names
of data
are not appropriate.
logical indicating whether inner plotting ranges should be determined and/or used. May also be the limits of the inner plotting range, if predetermined, see Details
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
.
value(s) for which a horizontal or vertical line will be
drawn (in addition to the gridlines). The default is given by
ploptions("zeroline")
.
list containing the plotting elements needed to set the attributes
logical: should existing attributes be replaced?
(for setvarattributes
) is a list of lists.
Its names identify the variables for which the attributes are
set or modified. Each component is a list which is added to the
existing attributes of the respective variable or replaces them if
they already exist.
a list of attributes to be set.
Each component must have a name giving the name of the variable
attribute to be set, and be itself a list (or a vector).
This list must have names that identify the variables in
data
for which the attributes are set.
See examples to understand this.
further arguments, which will be collected and used as or
added to list
Werner A. Stahel
If the attribute innerrange
is replaced, then plcoord
is
also replaced.
innerrange
may be a named list of ranges with names
corresponding to variables (not necessarily all of them),
or a scalar vector of length 2 to be used as range for all the
variables.
It can also be a logical vector superseding the argument
innerrange
, either named (as just mentioned) or
unnamed, to be repeated the appropriate number of times.
data(d.blast)
dd <- genvarattributes(d.blast)
str(attributes(dd$tremor))
ddd <- setvarattributes(dd, list( tremor=list(ticksat=seq(0,24,2),
ticklabelsat = seq(0,24,10), ticklabels=c("low","medium","high")) ) )
str(attributes(ddd$tremor))
data(d.river)
plyx(O2+H2CO3+T ~ date, data=d.river, subset=as.Date(date)
Run the code above in your browser using DataLab