Define contrast colors by group colors
Usage
contrast_colors_by_group(
sedesign,
sample_color_list = NULL,
group_name = "Group",
contrast_sep = "-",
C_min = 80,
C_max = 100,
L_min = 35,
L_max = 70,
default_color_style = c("categorical", "navy"),
verbose = FALSE,
...
)Arguments
- sedesign
SEDesignobject- sample_color_list
listof colors, with one list element with name defined bygroup_name, default"Group", so the colors usesample_color_list[[group_name]]. This element should be acharactervector of colors, whose names are group names used in thecontrast_names(sedesign). Thesample_color_listis produced byplatjam::design2colors(). Alternatively, acharactervector of colors, named by contrast.- group_name
characterstring for the element insample_color_listthat contains group colors.- contrast_sep
characterstring used as delimiter between group names in each contrast name, default is"-".- C_min, C_max
numericvalue to impose a minimum and maximum chroma (C) value for the resulting contrast color.- L_min, L_max
numericvalue to impose a minimum and maximum luminance (C) value for the resulting contrast color.- default_color_style
characterstring indicating how to assign colors to groups without a color assignment."categorical": callscolorjam::group2colors()which callscolorjam::rainbowJam()for rainbow categorical colors.any single R color: this one R color is applied to all other groups.
any non-R color: assumed to be the name of a color gradient or set, and is resolved by calling
jamba::getColorRamp(). It recognizes RColorBrewer and viridis color sets for example.vector of multiple colors: also resolved by calling
jamba::getColorRamp()which creates a gradient across the colors.
- verbose
logicalindicating whether to print verbose output.- ...
additional arguments are passed to
colorjam::group2colors(), orjamba::getColorRamp()as needed.
Details
This function takes colors assigned to groups, and applies them to contrasts based upon the groups represented in each contrast. Group colors are blended into one output color per contrast, then the color is adjusted for minimum chroma (C) and maximum luminance (L) to ensure the colors have acceptable vibrance.
When sample_color_list is supplied, which defines colors per group,
these colors are used as appropriate.
When sample_color_list is not supplied, categorical colors are
defined for all observed group names using colorjam::group2colors().
See also
Other jam experiment design:
check_sedesign(),
contrast2comp(),
contrast_names_to_sedesign(),
contrasts_to_factors(),
contrasts_to_venn_setlists(),
draw_oneway_contrast(),
draw_twoway_contrast(),
filter_contrast_names(),
groups_to_sedesign(),
plot_sedesign(),
sedesign_to_factors(),
validate_sedesign()