View source: R/ternary_diagram.R
ternary_diagram | R Documentation |
Generates a ternary diagram from compositional data, with options to center, scale, and color the points by group. Optionally overlays principal components.
ternary_diagram(
X,
group = NULL,
center = FALSE,
scale = FALSE,
show_pc = FALSE
)
X |
A numeric matrix or data frame of compositional data with exactly three columns. |
group |
A factor or character vector indicating groups for color coding (optional). |
center |
Logical. Should the data be centered before plotting? Default is FALSE. |
scale |
Logical. Should the data be scaled to unit variance? Default is FALSE. |
show_pc |
Logical. If TRUE, principal components are overlaid. Default is FALSE. |
A ggtern
plot object (inherits from ggplot
).
X = milk_cows[,5:7]
group = milk_cows$group
ternary_diagram(X, group = group)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.