Learn R Programming

adegraphics (version 1.0-4)

triangle.class: Ternary plot with a partition in classes (levels of a factor)

Description

This function represents a three dimensional scatter plot with a partition in classes (levels of a factor).

Usage

triangle.class(dfxyz, fac, wt = rep(1, NROW(fac)), labels = levels(fac), 
  col = NULL, ellipseSize = 1, starSize = 1, chullSize = NULL, adjust = TRUE, 
  min3d = NULL, max3d = NULL, showposition = TRUE, facets = NULL, plot = TRUE, 
  storeData = TRUE, add = FALSE, pos = -1, ...)

Arguments

dfxyz
a three columns data frame used to produce the plot
fac
a factor (or a matrix of factors) splitting the rows of dfxyz
wt
a vector of weights for fac
labels
a character vector containing the class' labels
col
a logical, a color or a colors vector to color points, ellipses, labels, lines and polygons
ellipseSize
a positive number for ellipse size
starSize
a number between 0 and 1 for the size of the stars segments joining the stars' center (centroids) and the matching points
chullSize
NULL or a vector of numbers between 0 and 1 for the fraction of points included in the convex hull
adjust
a logical to adjust the device with the limits of the smaller equilateral triangle containing the values
min3d
a vector of three values for triangular minimal limits
max3d
a vector of three values for triangular maximal limits
showposition
a logical indicating whether the used triangle should be shown in the complete one
facets
a factor splitting the rows of dfxyz so that subsets of the data are represented on different sub-graphics
plot
a logical indicating if the graphics is displayed
storeData
a logical indicating if the data are stored in the returned object. If FALSE, only the names of the data arguments are stored
add
a logical. If TRUE, the graphic is superposed to the graphics already plotted in the current device
pos
an integer indicating the position of the environment where the data are stored, relative to the environment where the function is called. Useful only if storeData is FALSE
...
additional graphical parameters (see adegpar and trellis.par.get)

Value

  • An object of class ADEg (subclass Tr.class) or ADEgS (if showposition is TRUE, if add is TRUE and/or if facets are used). The result is displayed if plot is TRUE.

See Also

Tr.class ADEg.Tr

Examples

Run this code
data(euro123, package = "ade4")
fac <- sort(rep(1:3, nrow(euro123$in78)))
df <- rbind.data.frame(euro123$in78, euro123$in86, euro123$in97)
row.names(df) <- paste(row.names(euro123$in78), rep(c(1, 2, 3), rep(12, 3)), sep = "")
triangle.class(df, fac = fac, label = row.names(df), showposition = TRUE, col = c(1, 2, 3))

Run the code above in your browser using DataLab