[R] getting 21 very different colours

Federico Calboli federico@c@lboli @ending from kuleuven@be
Tue Sep 11 09:34:51 CEST 2018

Hi All,

I am plotting a scatterplot of 21 populations, and I am using rainbow(21)[pops.col] to generate 21 colours for the plot (which works).  Maybe it is because I can really process few colours at a time, but the differences between the colours are not as strong as I’d like.  I can specify start and end for rainbow(), but if anything that looks worse if I do not just stick to 0 and 1.  

Is there a way of getting a set of 21 colours that maximises the differences between them?  

I could pick them by hand, but that is about 15 colours more than I know (I have a detailed colourchart, but the visual differences between ’skyblue’ and ’slategrey’ elude me when plotted as dots on a plot).


Federico Calboli
LBEG - Laboratory of Biodiversity and Evolutionary Genomics
Charles Deberiotstraat 32 box 2439
3000 Leuven
+32 16 32 87 67

More information about the R-help mailing list