Generates a ternary diagram from compositional data, with options to center, scale,
and color the points by group. Optionally overlays principal components.
Usage
ternary_diagram(
X,
group = NULL,
center = FALSE,
scale = FALSE,
show_pc = FALSE
)
Value
A ggtern plot object (inherits from ggplot).
Arguments
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.