Have a look at the Polychrome package by Kevin Coombes and Guy Brock:
https://CRAN.R-project.org/package=Polychrome
This employs the LUV space (with HCL = polar LUV) to get many distinct
distinguishable colors. For a few first steps, see:
https://CRAN.R-project.org/web/packages/Polychrome/vignettes/polychrome.html
On Wed, 12 Sep 2018, Zach Simpson wrote:
> Hi Federico
>
> For a possible alternative, the scico package provides a nice
> collection of color palettes that are designed to be both color-blind
> friendly and differentiable:
>
> https://www.data-imaginist.com/2018/scico-and-the-colour-conundrum/
>
> You could generate a vector of 21 colors (spaced as far apart as
> possible on the palette) to pass to your plot arguments with something
> like:
>
> library(scico)
> scico(21, palette = 'oleron')
>
> Not sure if this works for your case though. But maybe another feature
> (shape?) could help differentiate the 21 points.
>
> Hope this helps,
> Zach Simpson
>
>> Message: 11
>> Date: Tue, 11 Sep 2018 07:34:51 +0000
>> From: Federico Calboli <federico.calboli at kuleuven.be>
>> To: "r-help at r-project.org" <r-help at r-project.org>
>> Subject: [R] getting 21 very different colours
>> Message-ID: <08A6397B-4D67-4195-A53A-1FD394F72B6C at kuleuven.be>
>> Content-Type: text/plain; charset="utf-8"
>>
>> 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).
>>
>> Cheers
>>
>> F
>> --
>> Federico Calboli
>> LBEG - Laboratory of Biodiversity and Evolutionary Genomics
>> Charles Deberiotstraat 32 box 2439
>> 3000 Leuven
>> +32 16 32 87 67
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>