ternary.field: Constructs a ternary field

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/ternary.field.R

Description

Constructs a trifield object, suitable for use with image and contour from a ternary grid

Usage

1
ternary.field(grid, vals, dim.out = NULL)

Arguments

grid

A ternary grid as returned e.g. by the ternary.grid function

vals

A vector of values where length(vals) == nrow(grid) as returned e.g. by the ternary.apply function

dim.out

Dimensions (rows and columns) of the output

Details

This function constructs a trifield object suitable for plotting. It may be the case that the dimension indices contained in the ternary grid object may not contain sufficient information to determine the dimensions of the output. In that case, explicit output dimensions can be provided using the dim.out argument. If the dim.out argument is NULL, then the maximum row and column indices (xi, yi) will be extracted from the ternary grid. Note that image plots the transposition of input matrices and that dim.out must be specified with this in mind.

Value

A list with x, y and z elements defining a plotting surface suitable for use with image and contour.

Author(s)

Tim Keitt <tkeitt@gmail.com

References

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

See Also

ternary.grid, image.default

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
# 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)

Example output



trifield documentation built on May 29, 2017, 11:44 p.m.