Last data update: 2014.03.03

R: Ternary or Triangular Plots.
PlotTernaryR Documentation

Ternary or Triangular Plots.

Description

PlotTernary plots in a triangle the values of three variables. Useful for mixtures (chemistry etc.).

Usage

PlotTernary(x, y = NULL, z = NULL, args.grid = NULL, lbl = NULL, main = "",...)

Arguments

x

vector of first variable. Will be placed on top of the triangle.

y

vector of second variable (the right corner).

z

vector of third variable (on the left corner).

args.grid

list of additional arguments for the grid. Set this argument to NA if no grid should be drawn. The usual color and linetype will be used.

main

overall title for the plot.

lbl

the labels for the corner points. Default to the names of x, y, z.

...

the dots are sent to points

Author(s)

Andri Signorell <andri@signorell.net> based on example code by W. N. Venables and B. D. Ripley mentioned

References

J. Aitchison (1986) The Statistical Analysis of Compositional Data. Chapman and Hall, p.360.

Venables, W. N. and Ripley, B. D. (2002) Modern Applied Statistics with S. Fourth edition. Springer.

See Also

example in Skye

Examples

# some random data in three variables
c1 <- runif(25)
c2 <- runif(25)
c3 <- runif(25)

# basic plot
par(mfrow=c(1, 2))
PlotTernary(c1, c2, c3, args.grid=NA)

## Not run: 
# plot with different symbols and a grid using a dataset from MASS
data(Skye, package="MASS")

PlotTernary(Skye[c(1,3,2)], pch=15, col=hred, main="Skye", 
            lbl=c("A Sodium", "F Iron", "M Magnesium"))

## End(Not run)            

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(DescTools)
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/DescTools/PlotTernary.Rd_%03d_medium.png", width=480, height=480)
> ### Name: PlotTernary
> ### Title: Ternary or Triangular Plots.
> ### Aliases: PlotTernary
> ### Keywords: hplot
> 
> ### ** Examples
> 
> # some random data in three variables
> c1 <- runif(25)
> c2 <- runif(25)
> c3 <- runif(25)
> 
> # basic plot
> par(mfrow=c(1, 2))
> PlotTernary(c1, c2, c3, args.grid=NA)
Warning message:
In PlotTernary(c1, c2, c3, args.grid = NA) : row(s) of X will be rescaled
> 
> ## Not run: 
> ##D # plot with different symbols and a grid using a dataset from MASS
> ##D data(Skye, package="MASS")
> ##D 
> ##D PlotTernary(Skye[c(1,3,2)], pch=15, col=hred, main="Skye", 
> ##D             lbl=c("A Sodium", "F Iron", "M Magnesium"))
> ## End(Not run)            
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>