Color-code three-part compositions with a ternary sextant color scale and return a color key.
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
)
Data frame of compositional data.
Column name for variable in df giving first proportion of ternary composition (string).
Column name for variable in df giving second proportion of ternary composition (string).
Column name for variable in df giving third proportion of ternary composition (string).
Ternary coordinates of the color scale center. (default = 1/3,1/3,1/3). NA puts center over the compositional mean of the data.
6 element character vector of rgb-codes.
Should a legend be returned along with the colors? (default=TRUE)
Should the data be shown on the legend? (default=TRUE)
Should the center be shown on the legend? (default=FALSE if center is at c(1/3, 1/3, 1/3), otherwise TRUE)
"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')
Should the legend be cropped to the data? (default=FALSE)
Should the function arguments be validated? (default=TRUE)
legend=FALSE: A vector of rgbs hex-codes representing the ternary balance scheme colors.
legend=TRUE: A list with elements "rgb" and "key".
# NOT RUN {
P <- as.data.frame(prop.table(matrix(runif(3^6), ncol = 3), 1))
TricoloreSextant(P, 'V1', 'V2', 'V3')
# }
Run the code above in your browser using DataLab