genvarattributes {plgraphics} | R Documentation |
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, varlabels = NULL, innerrange.limits = NULL, replace=FALSE, ploptions = NULL) setvarattributes(data, attributes = NULL, list = NULL, ...)
data |
data.frame consisting of the variables (columns) to be characterized by their attributes |
vnames |
names of variables to be treated as y variables |
vcol, vlty, vpch |
color, line type and plotting character
to be used when multiple y-s are plotted (in the sense of
|
varlabels |
labels of the variables, in the case that the
|
innerrange.limits |
limits of the inner plotting range, if predetermined |
ploptions |
list containing the plotting elements needed to set the attributes |
replace |
logical: should existing attributes be replaced? |
attributes |
(for |
list |
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
|
... |
further arguments, which will be collected and used as or
added to |
If the attribute innerrange
is replaced, then plcoord
is
also replaced.
Data.frame, returning the original values, but the variables are
supplemented by the following attributes
, where available:
nvalues |
number of distinct values |
innerrange |
inner plotting range |
plcoord |
plotting coordinates |
ticksat |
tick marks for axis |
varlabel |
label to be used as axis label |
Werner A. Stahel
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)<as.Date("2010-02-28")) dd <- setvarattributes(d.river, list=list(vcol=c(O2="blue", T="red")), vpch=c(O2=1, T="T", H2CO3=5) ) attributes(dd$O2) plyx(O2+H2CO3+T ~ date, data=d.river, subset=as.Date(date)<as.Date("2010-02-28"))