TricoloreSextant: Ternary Sextant Color Scale

Description Usage Arguments Value Examples

Description

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

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
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

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

tricolore documentation built on April 28, 2020, 5:10 p.m.