colors.distinct: Get 'n' Distinct Colors

Description Usage Arguments Value Examples

Description

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.

Usage

1

Arguments

n

the number of distinct colors we want

Value

a vector of n distinct colors

Examples

 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));

thomasWeise/plotteR documentation built on May 29, 2019, 5:41 a.m.