Description Usage Arguments Details Value Author(s) References See Also Examples
Convert a simple specification list into a Lattice plot call, or the inverse operation.
1 2 3 | latticistCompose(dat, spec = list(),
datArg = substitute(dat),
enclos = parent.frame())
|
dat |
a data frame (with numeric and/or categorical variables). |
spec |
a list specifying the latticist plot. See Details. |
datArg |
the symbol to use for |
enclos |
an |
Elements of spec can include:
xvar, yvar, zvarvariables (or expressions) for the x, y and z axes.
If all are missing, a hypervariate plot is produced according to
defaultPlot (see below).
Note that x or y may be discretized by setting doXDisc or
doYDisc (see below).
groupsa grouping variable or color-coding covariate. This can refer to either a categorical or numeric variable. Many plot types support continuous color covariates, in which case a colorkey will be drawn. For categorical groups a standard key will be drawn.
cond, cond2conditioning variables. These will be turned into shingles if required,
with nLevels distinct levels (see below).
subsetsubset expression.
varSubseta character vector, the subset of variables (from the data frame) to include in hypervariate plots.
defaultPlotone of "marginal.plot", "splom" or "parallel". Specifies the type
of plot to produce if xvar and yvar are
missing. Note that groups is supported by all these plots,
and cond is supported by "splom" and "parallel".
NOTE: when the data is a table, "parallel" does
not produce a parallel plot, but rather a stacked
barchart of the table.
Also when the data is a table, "splom" produces a
pairs layout of mosaic plots.
aspectpanel aspect ratio, as a numeric value (= y / x), or one of the values "fill", "iso", "xy".
doLineswhether to add lines to relevant plot types (i.e. those involving
numeric variables).
For dotplot and cloud this refers to droplines (type
"h") (though if groups are defined in a dotplot, type
"l" is used).
In a grouped stripplot, group medians are joined (type
"a", fun = median).
For qqmath the points are joined in order (type "l").
For xyplot and similar, the line type depends on the nature
of the data; if the data x values form a regular sequence or are
few in number they are simply joined (type "l");
if duplicate x values are detected, with a reasonable number of
unique values, their averages are joined (type "a");
otherwise a smoothing line is added according to
latticist.getOption("xyLineType"). This defaults to
"smooth" (loess fit), but could reasonably be set to
"r" (regression line) or "a" (joined averages).
doHexbinwhether to use hexbinplot rather than xyplot for
bivariate numeric plots. These can be faster and more effective
for large datasets. Note that groups are not supported.
doSegments, doAsErrorif doSegments is TRUE when all of xvar, yvar
and zvar are defined, a segplot is produced where
the x values are joined to z values by horizontal
segments. Alternatively, if doAsError is TRUE, segments are
drawn from (x - z) to (x + z), and each x point is
marked, such that z acts as an error or range about x.
doTilewhen drawing a bivariate numeric plot with a color-covariate
(i.e. when xvar, yvar and groups are all
numeric), this option will draw a tileplot, which draws a
polygon enclosing each point. This may be appropriate when x and y
are on the same scale.
doXDisc, doYDiscset to discretize xvar and/or yvar, if they are
numeric. Either cut or equal.count is used,
depending on the plot type, with nLevels distinct levels.
nLevelsnumber of levels for discretizing cond and cond2,
optionally xvar or yvar, and in some cases
groups. For shingles, the amount of overlap is taken from
latticist.getOption("shingle.overlap").
x.relation, y.relationdefines the scales in conditioned lattice plots. Can have values in "free", "same" or "sliced".
doSeparateStratawhen a mosaic plot is produced and cond or
cond2 are defined, this defines whether to separate the
strata defined by conditioning variables into different panels
(the default; uses cotabplot), or to include the
conditioning variables in the one mosaic plot
(doSeparateStata = FALSE).
Note that xvar, yvar, zvar, groups, cond, cond2, subset must be
character strings (or NULL), and will be parsed.
latticistCompose returns a call.
Felix Andrews felix@nfrac.org
For an excellent introduction to and coverage of Lattice:
Sarkar, Deepayan (2008) "Lattice: Multivariate Data Visualization with R", Springer. http://lmdvr.r-forge.r-project.org/
latticist,
Lattice
1 2 3 4 5 6 7 8 9 | latticistCompose(CO2)
latticistCompose(CO2, spec = list(defaultPlot = "parallel"))
latticistCompose(CO2, spec = list(xvar = "uptake"))
latticistCompose(CO2, spec = list(yvar = "uptake"))
latticistCompose(CO2, spec = list(yvar = "uptake", doYDisc = TRUE))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.