TricoloreSextant {tricolore}R Documentation

Ternary Sextant Color Scale

Description

Color-code three-part compositions with a ternary sextant color scale and return a color key.

Usage

TricoloreSextant(
  df,
  p1,
  p2,
  p3,
  center = rep(1/3, 3),
  values = c("#FFFF00", "#B3DCC3", "#01A0C6", "#B8B3D8", "#F11D8C", "#FFB3B3"),
  legend = TRUE,
  show_data = TRUE,
  show_center = TRUE,
  label_as = ifelse(identical(center, rep(1/3, 3)), "pct", "pct_diff"),
  crop = FALSE,
  input_validation = TRUE
)

Arguments

df

Data frame of compositional data.

p1

Column name for variable in df giving first proportion of ternary composition (string).

p2

Column name for variable in df giving second proportion of ternary composition (string).

p3

Column name for variable in df giving third proportion of ternary composition (string).

center

Ternary coordinates of the color scale center. (default = 1/3,1/3,1/3). NA puts center over the compositional mean of the data.

values

6 element character vector of rgb-codes.

legend

Should a legend be returned along with the colors? (default=TRUE)

show_data

Should the data be shown on the legend? (default=TRUE)

show_center

Should the center be shown on the legend? (default=FALSE if center is at c(1/3, 1/3, 1/3), otherwise TRUE)

label_as

"pct" for percent-share labels or "pct_diff" for percent-point-difference from center labels. (default='pct' if center is at c(1/3, 1/3, 1/3), otherwise 'pct_diff')

crop

Should the legend be cropped to the data? (default=FALSE)

input_validation

Should the function arguments be validated? (default=TRUE)

Value

Examples

P <- as.data.frame(prop.table(matrix(runif(3^6), ncol = 3), 1))
TricoloreSextant(P, 'V1', 'V2', 'V3')


[Package tricolore version 1.2.4 Index]