ternary.grid: Constructs a ternary grid

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

View source: R/ternary.grid.R

Description

The function builds a rectangular lattice of points bounded by an equilateral triangle with unit altitude. It can be used with ternary.apply and ternary.field to create a surface of values for plotting.

Usage

1
ternary.grid(grid.size)

Arguments

grid.size

The number of rows and columns in the grid

Details

The size of the grid is the number of rows and colunn in the rectangular region bounding the ternary plot region. The number of output x, y and corresponding a, b, c points will be less than rows times columns because many x, y points fall outside the ternary region. In all cases, the sum of a, b and c will be unity.

Value

Data frame with columns

x

x-coordinate

y

y-coordinate

xi

column indices (I think)

yi

row indices (I think)

a

distance along first ternary axis

b

distance along second ternary axis

c

distance along third ternary axis

Author(s)

Tim Keitt <tkeitt@gmail.com>

References

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

See Also

ternary.apply, ternary.grid

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.