Learn R Programming

robCompositions (version 2.4.1)

ternaryDiag: Ternary diagram

Description

This plot shows the relative proportions of three variables (compositional parts) in one diagramm. Before plotting, the data are scaled.

Usage

ternaryDiag(
  x,
  name = colnames(x),
  text = NULL,
  grid = TRUE,
  gridCol = grey(0.6),
  mcex = 1.2,
  line = "none",
  robust = TRUE,
  group = NULL,
  tol = 0.975,
  ...
)

Arguments

x

matrix or data.frame with 3 columns

name

names of the variables

text

default NULL, text for each point can be provided

grid

if TRUE a grid is plotted additionally in the ternary diagram

gridCol

color for the grid lines

mcex

label size

line

may be set to “none”, “pca”, “regression”, “regressionconf”, “regressionpred”, “ellipse”, “lda”

robust

if line equals TRUE, it dedicates if a robust estimation is applied or not.

group

if line equals “da”, it determines the grouping variable

tol

if line equals “ellipse”, it determines the parameter for the tolerance ellipse

...

further parameters, see, e.g., par()

Author

Peter Filzmoser <P.Filzmoser@tuwien.ac.at>, Matthias Templ <matthias.templ@fhnw.ch>

Details

The relative proportions of each variable are plotted.

References

Reimann, C., Filzmoser, P., Garrett, R.G., Dutter, R. (2008) Statistical Data Analysis Explained. Applied Environmental Statistics with R. John Wiley and Sons, Chichester.

Examples

Run this code

data(arcticLake)
ternaryDiag(arcticLake)

data(coffee)
x <- coffee[,2:4]
grp <- as.integer(coffee[,1])
ternaryDiag(x, col=grp, pch=grp)
ternaryDiag(x, grid=FALSE, col=grp, pch=grp)
legend("topright", legend=unique(coffee[,4]), pch=1:2, col=1:2)

ternaryDiag(x, grid=FALSE, col=grp, pch=grp, line="ellipse", tol=c(0.975,0.9), lty=2)
ternaryDiag(x, grid=FALSE, line="pca")
ternaryDiag(x, grid=FALSE, col=grp, pch=grp, line="pca", lty=2, lwd=2)

Run the code above in your browser using DataLab