R/colorjam-rainbowjammulti.R
rainbowJamMulti.Rd
Rainbow categorical colors across multiple groups
rainbowJamMulti(ns, do_plot = FALSE, ...)
integer
vector of n
values passed to
rainbowJam()
.
logical
indicating whether to plot the result
using jamba::showColors()
.
additional arguments are passed to rainbowJam()
.
list
of categorical colors, length equal to the
input length(ns)
, with color vectors with lengths ns
.
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.
Other colorjam assignment:
col_div_xf()
,
col_linear_xf()
,
group2colors()
,
matrix2heatColors()
,
vals2colorLevels()
,
vibrant_color_by_hue()
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);