Description Usage Arguments Value Examples
Get a list of n
distinct colors.
This is currently just a very preliminary method, not beautiful and far from
optimal. For instance, if more colors are required than what the internally
pre-defined palettes can do, we try to uniformly sample from the RGB space
with the goal to get maximally distant colors.
1 |
n |
the number of distinct colors we want |
a vector of n
distinct colors
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | library(plotteR)
# set the random seed for reproducibility
set.seed(129855L);
if(!exists("x.range")) x.range <- 4L;
if(!exists("y.range")) y.range <- 5L;
# set the number of diagrams appropriately
old.par <- par(mfrow=c(y.range, x.range), mai=c(0.02, 0.02, 0.02, 0.02));
# paint the diagrams
n <- 1L;
for(y in 1L:y.range) {
for(x in 1L:x.range) {
plot.colors(colors.distinct(n));
n <- n + 1L;
}
}
# reset the parameters
invisible(par(old.par));
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.