Learn R Programming

Ternary (version 2.3.3)

TernaryCoords: Convert ternary coordinates to Cartesian space

Description

Convert coordinates of a point in ternary space, in the format (a, b, c), to x and y coordinates of Cartesian space, which can be sent to standard functions in the 'graphics' package.

Usage

TernaryCoords(
  abc,
  b_coord = NULL,
  c_coord = NULL,
  direction = getOption("ternDirection", 1L),
  region = getOption("ternRegion", ternRegionDefault)
)

# S3 method for matrix TernaryToXY( abc, b_coord = NULL, c_coord = NULL, direction = getOption("ternDirection", 1L), region = getOption("ternRegion", ternRegionDefault) )

# S3 method for numeric TernaryToXY( abc, b_coord = NULL, c_coord = NULL, direction = getOption("ternDirection", 1L), region = getOption("ternRegion", ternRegionDefault) )

TernaryToXY( abc, b_coord = NULL, c_coord = NULL, direction = getOption("ternDirection", 1L), region = getOption("ternRegion", ternRegionDefault) )

Value

TernaryCoords() returns a vector of length two that converts the coordinates given in abc into Cartesian (x, y) coordinates corresponding to the plot created by the last call of TernaryPlot().

Arguments

abc

A vector of length three giving the position on a ternary plot that points in the direction specified by direction (1 = up, 2 = right, 3 = down, 4 = left). c(100, 0, 0) will plot in the direction-most corner; c(0, 100, 0) will plot in the corner clockwise of direction; c(0, 0, 100) will plot in the corner anti-clockwise of direction. Alternatively, the a coordinate can be specified as the first parameter, in which case the b and c coordinates must be specified via b_coord and c_coord. Or, a matrix with three rows, representing in turn the a, b and c coordinates of points.

b_coord

The b coordinate, if abc is a single number.

c_coord

The c coordinate, if abc is a single number.

direction

(optional) Integer specifying the direction that the current ternary plot should point: 1, up; 2, right; 3, down; 4, left.

region

(optional) Named list of length two specifying the the minimum and maximum values of each ternary axis to be drawn (e.g. list(min = c(40, 0, 0), max = c(100, 60, 60)); or a set of coordinates in a format accepted by TernaryPoints(). The plotted region will correspond to the smallest equilateral triangle that encompasses the specified ranges or coordinates.

See Also

  • TernaryPlot()

Other coordinate translation functions: ReflectedEquivalents(), TriangleCentres(), XYToTernary()

Examples

Run this code
TernaryCoords(100, 0, 0)
TernaryCoords(c(0, 100, 0))

coords <- matrix(1:12, nrow = 3)
TernaryToXY(coords)

Run the code above in your browser using DataLab