tritext: Plot text within a Holmans triangle

View source: R/holmans_triangle.R

tritextR Documentation

Plot text within a Holmans triangle

Description

Plot text within a Holmans triangle (an equilateral triangle used to depict trinomial distributions).

Usage

tritext(x, labels, ...)

Arguments

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 x.

...

Passed to graphics::text().

Details

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.

Value

Text is plotted at the (x,y) coordinates of the points.

See Also

triplot(), trilines(), triarrow(), tripoints()

Examples

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))


broman documentation built on May 29, 2024, 7:18 a.m.

Related to tritext in broman...