[R] Creating a vector of colours that are as different from one another as possible

Ross Ihaka ihaka at stat.auckland.ac.nz
Wed Dec 22 20:04:19 CET 2004


michael watson (IAH-C) wrote:
> Hi
> 
> I want to create a vector of colors that are as different from one
> another as possible.  ?rainbow states "Conceptually, all of these
> functions actually use (parts of) a line cut out of the 3-dimensional
> color space...".  This suggests to me that the resulting colors are all
> placed on this "line" and are equi-distant along it.  The resulting
> color palette is a range of colours where adjacent colours are actually
> quite similar, especially when n (the number of colours) is high.
> 
> Conceptually I guess what I want is colors from a 3D polygon in 3D
> colour space, where the number of vertices in the polygon is n,
> resulting in a color palette where the colors are all quite different
> from one another.  Is this possible or am I talking crap? (I've only had
> one coffee this morning)

First, you want to be using a color space where distance corresponds
to perception of similarity/difference.  There are a number of
perceptually based spaces which approximate this (CIELUV, CIELAB
and Munsell).  You could put your points in one of these spaces
and them move them about until they are as far from each other
as possible.

Second, it's generally considered bad practice to use more that
six colors in a single display.  Given the approximate nature of
the uniformity of the perceptual color spaces you could consider
placing this many points "by hand."

How much sense this makes depends on what it is you are trying to do.

(I found reading some of what Munsell had to say pretty informative.)

-- 
Ross Ihaka                         Email:  ihaka at stat.auckland.ac.nz
Department of Statistics           Phone:  (64-9) 373-7599 x 85054
University of Auckland             Fax:    (64-9) 373-7018
Private Bag 92019, Auckland
New Zealand




More information about the R-help mailing list