Learn R Programming

isopleuros (version 1.4.0)

ternary_text: Add Text to a Ternary Plot

Description

Draws the strings given in the vector labels at the coordinates given by x, y and z.

Usage

ternary_text(x, y, z, ...)

# S4 method for numeric,numeric,numeric ternary_text( x, y, z, center = FALSE, scale = FALSE, labels = seq_along(x), ... )

# S4 method for ANY,missing,missing ternary_text(x, center = FALSE, scale = FALSE, labels = seq_along(x$x), ...)

Value

ternary_text() is called it for its side-effects.

Arguments

x, y, z

A numeric vector giving the x, y and z ternary coordinates of a set of points. If y and z are missing, an attempt is made to interpret x in a suitable way (see grDevices::xyz.coords()).

...

Further arguments to be passed to graphics::text().

center

A logical scalar specifying wether the data should be centered, or a numeric vector giving the center.

scale

A logical scalar specifying wether the data should be scaled, or a numeric vector giving the scale factor.

labels

A character vector or expression specifying the text to be written.

Author

N. Frerebeau

See Also

graphics::text()

Other geometries: ternary_arrows(), ternary_crosshairs(), ternary_image(), ternary_labels(), ternary_lines(), ternary_points(), ternary_polygon(), ternary_segments()

Examples

Run this code
## Compositional data
coda <- data.frame(
  X = c(20, 60, 20),
  Y = c(20, 20, 60),
  Z = c(60, 20, 20)
)

## Add text
ternary_plot(NULL, panel.first = ternary_grid())
ternary_text(coda, labels = c("A", "B", "C"), col = "red", cex = 2)

Run the code above in your browser using DataLab