View source: R/ternary_diagram.R
| ternary_diagram | R Documentation |
Create a ternary diagram from compositional data with exactly three parts. Optionally center and/or scale the data in log-ratio coordinates, color points by group, and overlay the first two principal component directions computed in ilr coordinates.
ternary_diagram(
X,
group = NULL,
center = FALSE,
scale = FALSE,
show_pc = FALSE
)
X |
A numeric matrix or data frame with exactly three columns (the parts of the composition). Values should be positive. Column names (if present) are used as corner labels. |
group |
Optional. A factor or character vector of length |
center |
Logical. If |
scale |
Logical or numeric. If |
show_pc |
Logical. If |
This function is kept as a convenient wrapper around the modular ternary API:
ternary_frame(), ternary_plot(), add_ternary_points(), and
add_ternary_pc().
A ggplot2 object.
ternary_frame, ternary_plot,
add_ternary_points, add_ternary_pc
X <- milk_cows[, 5:7]
group <- milk_cows$group
ternary_diagram(X, group = group)
ternary_diagram(X, group = group, center = TRUE, scale = TRUE)
ternary_diagram(X, group = group, center = TRUE, scale = 1.5)
ternary_diagram(X, show_pc = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.