ternary_diagram {coda.plot}R Documentation

Ternary Diagram

Description

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
)

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.

Value

A ggtern plot object (inherits from ggplot).

Examples

X = milk_cows[,5:7]
group = milk_cows$group
ternary_diagram(X, group = group)


[Package coda.plot version 0.1.9 Index]