transform_tern_to_cart(...)
is a function that
takes input numeric vectors for the T
, L
and R
species, or, alternatively, a data.frame
with columns T
, L
and R
(Mandatory
Column Names), and, transforms the data from the ternary
space, to the cartesian space where x
and y
are in the range [0,1]
and [0,$sin(\pi/3)$]
respectively. The limits for T
, L
and
R
MAY NOT NECESSARILY be in the range
[0,1]
, however, this is the default range.transform_tern_to_cart(T, L, R,
data = data.frame(T = T, L = L, R = R), ...,
Tlim = c(0, 1), Llim = c(0, 1), Rlim = c(0, 1),
cw = TRUE, scale = TRUE)
data.frame
containing
columns T
, L
and R
. If not specified
(Default), it will be produced from the T
,
L
and R
parameters for use in the
functdata.frame
object with columns x
and
y
representing the transformed coordinates, and,
number of rows equal to that of the data
argument.
In other words, a '1 to 1' transformation from the
ternary to the cartesian space.1.0
, the user has the option to scale the data so
that this is satisfied. Negative values may be of
interest when trying to determine the coordinates of a
point 'outside' of the ternary plot surface, however,
they must still sum to unity. Custom Limits can be applied for T
, L
and
R
species (by the parameters Tlim
,
Llim
and Rlim
, respectively), however, if
they are non-standard (ie [0,1]), then checks are made so
that non-sensical results are not implied and, an error
will be thrown if such non-sensical results exist, IE,
All points MUST sum to unity given that the axis
extremes should meet at the vertices of the plot area.
By the above statement, the following constraints must
hold TRUE
:
min(Llim) + min(Rlim) = 1
ANDmin(Tlim)
+ max(Llim) +
min(Rlim) = 1
ANDmin(Tlim) +
min(Llim)
+ max(Rlim) = 1#Species Concentrations
T=c(1,0,0) #TOP
L=c(0,1,0) #LEFT
R=c(0,0,1) #RIGHT
#Transform
transform_tern_to_cart(T,L,R)
Run the code above in your browser using DataLab