View source: R/holmans_triangle.R
tritext | R Documentation |
Plot text within a Holmans triangle (an equilateral triangle used to depict trinomial distributions).
tritext(x, labels, ...)
x |
A matrix with three rows, each column being a trinomial distribution. |
labels |
A vector of character strings, with length equal to the number of columns of |
... |
Passed to |
Plot of an equilateral triangle, in order to depict trinomial
distributions. A trinomial distribution (that is, a trio of
non-negative numbers that add to 1) is equated to a point in the
triangle through the distances to the three sides. This makes use of
the fact that for any point in an equilateral triangle, the sum of the
distances to the three sides is constant.
First use triplot()
to first plot the equilateral triangle.
Text is plotted at the (x,y) coordinates of the points.
triplot()
, trilines()
,
triarrow()
, tripoints()
triplot()
x <- cbind(c(0.25, 0.5, 0.25), c(1/3, 1/3, 1/3))
tripoints(x, lwd=2, pch=21, bg="lightblue")
xp <- x + c(0.02, 0, -0.02)
tritext(xp, c("(1/4,1/2,1/4)", "(1/3,1/3,1/3)"), adj=c(0, 0.5))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.