TernaryContour {Ternary} | R Documentation |
Draws contour lines to depict the value of a function in ternary space.
TernaryContour( Func, resolution = 96L, direction = getOption("ternDirection", 1L), within = NULL, ... )
Func |
Function taking vectors of coordinates |
resolution |
The number of triangles whose base should lie on the longest axis of the triangle. Higher numbers will result in smaller subdivisions and smoother colour gradients, but at a computational cost. |
direction |
(optional) Integer specifying the direction that the current ternary plot should point: 1, up; 2, right; 3, down; 4, left. |
within |
List or matrix of x, y coordinates within which contours
should be evaluated, in any format supported by
|
... |
Further parameters to pass to |
Martin R. Smith (martin.smith@durham.ac.uk)
Other contour plotting functions:
ColourTernary()
,
TernaryDensityContour()
,
TernaryPointValues()
TernaryPlot(alab = "a", blab = "b", clab = "c") FunctionToContour <- function (a, b, c) { a - c + (4 * a * b) + (27 * a * b * c) } values <- TernaryPointValues(FunctionToContour, resolution = 24L) ColourTernary(values) TernaryContour(FunctionToContour, resolution = 36L) # Note that FunctionToContour is sent a vector. # Instead of BadMax <- function (a, b, c) { max(a, b, c) } # Use GoodMax <- function (a, b, c) { pmax(a, b, c) } TernaryPlot(alab = "a", blab = "b", clab = "c") ColourTernary(TernaryPointValues(GoodMax)) TernaryContour(GoodMax) # Or, for a generalizable example, GeneralMax <- function (a, b, c) { apply(rbind(a, b, c), 2, max) } TernaryPlot(alab = "a", blab = "b", clab = "c") ColourTernary(TernaryPointValues(GeneralMax)) TernaryContour(GeneralMax)