Learn R Programming

trifield (version 1.1)

plot.trifield: Plot a ternary field

Description

A simple wrapper around image and contour for plotting ternary fields

Usage

"plot"(x, contours = TRUE, col = topo.colors(256), lab1 = "A = 0", lab2 = "B = 0", lab3 = "C = 0", tribox = TRUE, axis.lines = TRUE, ...)

Arguments

x
An object of class trifield
contours
Make contours?
col
Color palette to use
lab1
First axis label
lab2
Second axis label
lab3
Third axis label
tribox
Draw a triangle around the plot?
axis.lines
Draw internal (altitute) axis lines?
...
Additional graphics parameters to be passed to plot

Value

None

Details

This is a small demo function showing how one can make a ternary contour plot from a trifield object. The input object can be any list with x, y and z fields, but the result will be odd if non-NA z-values fall outside an equilateral triangle with unit altitude.

References

http://dx.doi.org/10.1016/j.ecolmodel.2012.05.020

See Also

plot.default, image.default, contour.default

Examples

Run this code
# See demo(trifield)
## Not run: 
# grid.size = 128
# par(mar = rep(2, 4), oma = rep(0, 4))
# tg = ternary.grid(grid.size)
# f = function(x)
#         sin(2 * pi * x[1]) +
#         sin(3 * pi * x[2]) +
#         sin(4 * pi * x[3])
# z = ternary.apply(tg, f)
# tf = ternary.field(tg, z)
# plot(tf)
# ternary.legend()
# ## End(Not run)

Run the code above in your browser using DataLab