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
SEDesign
object- sample_color_list
list
of colors, with one list element with name defined bygroup_name
, default"Group"
, so the colors usesample_color_list[[group_name]]
. This element should be acharacter
vector of colors, whose names are group names used in thecontrast_names(sedesign)
. Thesample_color_list
is produced byplatjam::design2colors()
. Alternatively, acharacter
vector of colors, named by contrast.- group_name
character
string for the element insample_color_list
that contains group colors.- contrast_sep
character
string used as delimiter between group names in each contrast name, default is"-"
.- C_min, C_max
numeric
value to impose a minimum and maximum chroma (C) value for the resulting contrast color.- L_min, L_max
numeric
value to impose a minimum and maximum luminance (C) value for the resulting contrast color.- default_color_style
character
string 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
logical
indicating 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()