rainbowJamMulti: Rainbow categorical colors across multiple groups

rainbowJamMultiR Documentation

Rainbow categorical colors across multiple groups

Description

Rainbow categorical colors across multiple groups

Usage

rainbowJamMulti(ns, do_plot = FALSE, ...)

Arguments

ns

integer vector of n values passed to rainbowJam().

do_plot

logical indicating whether to plot the result using jamba::showColors().

...

additional arguments are passed to rainbowJam().

Details

This function applies colorjam::rainbowJam() to multiple vectors, such that the categorical colors are not duplicated, and are assigned as well-spaced across the rainbow for each group as possible.

Value

list of categorical colors, length equal to the input length(ns), with color vectors with lengths ns.

See Also

Other colorjam assignment: col_div_xf(), col_linear_xf(), group2colors(), matrix2heatColors(), vals2colorLevels(), vibrant_color_by_hue()

Examples

opar <- par("mfrow"=c(3, 1));
on.exit(par(opar));
ns <- c(A=8, B=3, C=4);
colorlist1 <- rainbowJamMulti(ns,
   do_plot=TRUE,
   main="rainbowJamMulti()");

# basic assignment in order
colorset2 <- colorjam::rainbowJam(sum(ns));
colorlist2 <- split(colorset2, rep(seq_along(ns), ns))
jamba::showColors(colorlist2, main="sequential assignment")

# re-assign the same colors
colorlist3 <- lapply(ns, colorjam::rainbowJam);
jamba::showColors(colorlist3, main="independent color assignment");
par(opar);


jmw86069/colorjam documentation built on March 18, 2024, 3:32 a.m.