Convert a simple specification list into a Lattice plot call, or the inverse operation.
1 2 3
a data frame (with numeric and/or categorical variables).
a list specifying the latticist plot. See Details.
the symbol to use for
spec can include:
xvar, yvar, zvar
variables (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
doYDisc (see below).
a 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.
conditioning variables. These will be turned into shingles if required,
nLevels distinct levels (see below).
a character vector, the subset of variables (from the data frame) to include in hypervariate plots.
one of "marginal.plot", "splom" or "parallel". Specifies the type
of plot to produce if
missing. Note that
groups is supported by all these plots,
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
panel aspect ratio, as a numeric value (= y / x), or one of the values "fill", "iso", "xy".
whether to add lines to relevant plot types (i.e. those involving
cloud this refers to droplines (type
"h") (though if groups are defined in a
"l" is used).
In a grouped
stripplot, group medians are joined (type
fun = median).
qqmath the points are joined in order (type
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
if duplicate x values are detected, with a reasonable number of
unique values, their averages are joined (type
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).
whether to use
hexbinplot rather than
bivariate numeric plots. These can be faster and more effective
for large datasets. Note that groups are not supported.
doSegments is TRUE when all of
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
(x - z) to
(x + z), and each x point is
marked, such that z acts as an error or range about x.
when drawing a bivariate numeric plot with a color-covariate
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.
set to discretize
yvar, if they are
equal.count is used,
depending on the plot type, with
nLevels distinct levels.
number of levels for discretizing
yvar, and in some cases
groups. For shingles, the amount of overlap is taken from
defines the scales in conditioned lattice plots. Can have values in "free", "same" or "sliced".
mosaic plot is produced and
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
latticistCompose returns a
Felix Andrews [email protected]
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/
1 2 3 4 5 6 7 8 9
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.