# tritrafo: Barycentric plots In klaR: Classification and Visualization

## Description

Function to carry out the transformation into 2D space for `triplot`, `trilines` etc.

## Usage

 `1` ```tritrafo(x, y = NULL, z = NULL, check = TRUE, tolerance = 0.0001) ```

## Arguments

 `x` Vector of fractions of first component OR 3-column matrix containing all three components (omitting `y` and `z`) OR 3-element vector (for all three components, omitting `y` and `z`). `y` (optional) vector of fractions of second component. `z` (optional) vector of fractions of third component. `check` if `TRUE`, it is checked whether `x+y+z=1` and `x,y,z>=0` for all cases. `tolerance` tolerance for above sum check.

## Details

Projects the mixture given by `x`, `y`, and `z` with `x`, `y`, `z` between one and zero and `x+y+z=1` into a two-dimensional space.

For further details see `triplot`.

## Value

A matrix with two columns corresponding to the two dimensions.

## Author(s)

Christian Röver, [email protected]

`triplot`, `tripoints`, `trilines`, `trigrid`

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13``` ```tritrafo(0.1, 0.2, 0.7) tritrafo(0.1, 0.2, 0.6) # warning triplot() points(tritrafo(0.1, 0.2, 0.7), col="red") tripoints(0.1, 0.2, 0.7, col="green") # the same tritrafo(c(0.1,0.2), c(0.3,0.4), c(0.6,0.4)) tritrafo(diag(3)) point <- c(0.25,0.6,0.15) triplot(point, pch=16) text(tritrafo(point), "(0.25, 0.60, 0.15)", adj=c(0.5,2)) # add a label ```

### Example output

```Loading required package: MASS
x          y
[1,] 0.3464102 -0.1333333
x    y
[1,] 0.2886751 -0.1
Warning message:
In tritrafo(0.1, 0.2, 0.6) : components do not sum to one
x           y
[1,] 0.2886751 -0.03333333
[2,] 0.1154701  0.06666667
x          y
[1,] -5.773503e-01 -0.3333333
[2,]  8.326673e-17  0.6666667
[3,]  5.773503e-01 -0.3333333
```

klaR documentation built on March 19, 2018, 5:03 p.m.