Description Usage Arguments Details Author(s) See Also Examples

Function to produce triangular (barycentric) plots illustrating proportions of 3 components, e.g. discrete 3D-distributions or mixture fractions that sum up to 1.

1 2 3 |

`x` |
Vector of fractions of first component
OR 3-column matrix containing all three components (omitting |

`y` |
(Optional) vector of fractions of second component. |

`z` |
(Optional) vector of fractions of third component. |

`main` |
Main title |

`frame` |
Controls whether a frame (triangle) and labels are drawn. |

`label` |
(Character) vector of labels for the three corners. |

`grid` |
Values along which grid lines are to be drawn (or |

`center` |
Controls whether or not to draw centerlines at which there is a
‘tie’ between any two dimensions (see also |

`set.par` |
Controls whether graphical parameter |

`...` |
Further graphical parameters passed to |

The barycentric plot illustrates the set of points (x,y,z) with x,y,z between 0 and 1 and x+y+z=1; that is, the triangle spanned by (1,0,0), (0,1,0) and (0,0,1) in 3-dimensional space. The three dimensions x, y and z correspond to lower left, upper and lower right corner of the plot. The greater the share of x in the proportion, the closer the point is to the lower left corner; Points on the opposite (upper right) side have a zero x-fraction. The grid lines show the points at which one dimension is held constant, horizontal lines for example contain points with a constant second dimension.

Christian Röver, roever@statistik.tu-dortmund.de

`tripoints`

, `trilines`

, `triperplines`

, `trigrid`

,
`triframe`

for points, lines and layout, `tritrafo`

for placing labels,
and `quadplot`

for the same in 4 dimensions.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | ```
# illustrating probabilities:
triplot(label = c("1, 2 or 3", "4 or 5", "6"),
main = "die rolls: probabilities", pch = 17)
triperplines(1/2, 1/3, 1/6)
# expected...
triplot(1/2, 1/3, 1/6, label = c("1, 2 or 3", "4 or 5", "6"),
main = "die rolls: expected and observed frequencies", pch = 17)
# ... and observed frequencies.
dierolls <- matrix(sample(1:3, size = 50*20, prob = c(1/2, 1/3, 1/6),
replace = TRUE), ncol = 50)
frequencies <- t(apply(dierolls, 1,
function(x)(summary(factor(x, levels = 1:3)))) / 50)
tripoints(frequencies)
# LDA classification posterior:
data(iris)
require(MASS)
pred <- predict(lda(Species ~ ., data = iris),iris)
plotchar <- rep(1,150)
plotchar[pred$class != iris$Species] <- 19
triplot(pred$posterior, label = colnames(pred$posterior),
main = "LDA posterior assignments", center = TRUE,
pch = plotchar, col = rep(c("blue", "green3", "red"), rep(50, 3)),
grid = TRUE)
legend(x = -0.6, y = 0.7, col = c("blue", "green3", "red"),
pch = 15, legend = colnames(pred$posterior))
``` |

```
Loading required package: MASS
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.