rainbowJam | R Documentation |
rainbow categorical colors using varied luminance and chroma
rainbowJam(
n = NULL,
preset = getOption("colorjam.preset", "dichromat2"),
step = getOption("colorjam.step", "default"),
Hstart = 0,
alpha = 1,
hues = NULL,
warpHue = NULL,
h1 = NULL,
h2 = NULL,
Cvals = NULL,
Lvals = NULL,
Crange = NULL,
Lrange = NULL,
phase = 1,
direction = c("1", "-1"),
do_hue_pad = FALSE,
hue_pad_percent = 0,
nameStyle = c("none", "n", "closest_named_color", "closestRcolor", "hcl", "color"),
min_requested_n = 3,
doTest = FALSE,
verbose = FALSE,
...
)
n |
|
preset |
|
step |
|
Hstart |
|
alpha |
|
hues |
|
warpHue |
|
h1 , h2 |
|
Cvals , Lvals |
|
Crange , Lrange |
|
phase |
|
direction |
|
do_hue_pad |
|
hue_pad_percent |
|
nameStyle |
|
min_requested_n |
|
doTest |
|
verbose |
|
... |
additional arguments are passed to
|
This function customizes similar functions grDevices::rainbow
,
colorspace::rainbow_hcl()
, and scales::hue_pal()
in two main
ways:
It uses the warped color wheel (see h2hw()
which compresses the
green component of the standard HCL color hue wheel, extending the yellow.
It uses a varying luminance and chroma vector which was selected to optimize visual distinctiveness of adjacent colors. There is still a limit to the maximum number of effectively different categorical colors, however this function appears to improve other available methods.
This function is also intended to enable use of a custom color wheel,
for example a set of color mappings could define color-blind friendly
ranges of colors when using the warped hue functions h2hw()
and
hw2h()
. When warpHue=TRUE
the values for h1
and
h2
are used to define a mapping from warped hues to standard
hues recognized by hcl()
.
character
vector of categorical colors
Other colorjam core:
blend_colors()
,
closestRcolor()
,
closest_named_color()
,
color_complement()
,
colors_to_df()
,
group2colors()
,
sort_colors()
,
subset_colors()
rainbowJam(12);
# show colors
jamba::showColors(rainbowJam(10));
# show colors
color_pie(rainbowJam(10));
# be fancy and label colors using the closest R named color
jamba::showColors(rainbowJam(6, nameStyle="closestRcolor"));
# or use the closest R color itself
jamba::showColors(names(rainbowJam(6, nameStyle="closestRcolor")));
# be fancy and label colors using the closest named_color
jamba::showColors(rainbowJam(6, nameStyle="closest_named_color"));
# be even fancier and use the nearest named color by its name
jamba::showColors(named_colors[names(rainbowJam(6, nameStyle="closest_named_color"))]);
# comparison of version 0.0.19.900 and update with version 0.0.20.900
cat19 <- rainbowJam_v1(n=12)
cat20 <- rainbowJam(n=12)
jamba::showColors(list(version19=cat19, version20=cat20))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.