A ternary plot is a triangular diagram that displays proportions of three variables. It can be used to map three-dimensional data to a two-dimensional surface with the caveat that the data's original scales are lost (unless it was proportional data to begin with).#'
ternaryplot(x, data, ...)# S3 method for formula
ternaryplot(
x,
data = NULL,
response = NULL,
groups = NULL,
density = FALSE,
region = density || !is.null(response),
contour = density || !is.null(response),
labels = !is.null(response),
colorkey = region,
xlab,
ylab,
zlab,
xlim = c(-0.15, 1.15),
ylim = c(-0.3, 1),
panel = panel.ternaryplot,
default.prepanel = lattice.getOption("prepanel.default.xyplot"),
drop.unused.levels = lattice.getOption("drop.unused.levels"),
subset = TRUE,
...
)
# S3 method for data.frame
ternaryplot(x, data = NULL, ...)
# S3 method for matrix
ternaryplot(x, data = NULL, ...)
An object of class "trellis"
. The
update
method can be used to
update components of the object and the
print
method (usually called by
default) will plot it on an appropriate plotting device.
See Methods (by class).
A data frame in which the formula
, groups
, and conditioning
variables are evaluated.
Arguments that are passed on to other methods, particularly
panel.ternaryplot()
.
An optional response variable
A variable or expression to be evaluated in data
and used to
distinguish groups by varying graphical parameters.
Compute two-dimensional density estimates via MASS::kde2d()
.
Fill density or response estimates with a color gradient.
Draw contour lines for density and response estimates.
Label contour lines.
if TRUE
automatically computes a colorkey for density
or response estimates. Can also be a list (see lattice::levelplot()
for
details on this).
X axis label (the left dimension)
Y axis label (the right dimension)
Z axis label (the top dimension)
X limits for the plot region.
Y limits for the plot region.
The panel function.
The default prepanel function.
Drop unused conditioning or groups levels.
An expression that evaluates to a logical or integer indexing vector. Like groups, it is evaluated in data. Only the resulting rows of data are used for the plot.
ternaryplot(formula)
: A formula of the form top ~ left * right
. Variables
will be evaluated inside data if provided.
ternaryplot(data.frame)
: A data frame for which the first three columns will
be mapped to the left, right, and top dimensions of the ternary plot
respectively.
ternaryplot(matrix)
: A matrix for which the
first three columns will be mapped to the left, right, and top
dimensions of the ternary plot respectively.
ternaryplot(Fertility ~ Agriculture * Catholic, data = swiss)
ternaryplot(Catholic ~ Examination * Education, response = Infant.Mortality,
data = swiss, contour = FALSE)
ternaryplot(Or ~ An * Ab | Feldspar, data = feldspar)
ternaryplot(Or ~ An * Ab, groups = Feldspar, data = feldspar, density = TRUE)
Run the code above in your browser using DataLab