You could also take a look at the 'Polychrome' package

Paul

On 12/09/18 03:36, Barry Rowlingson wrote:
On Tue, Sep 11, 2018 at 11:43 AM, Duncan Murdoch <murdoch.dun...@gmail.com>
wrote:

On 11/09/2018 3:34 AM, Federico Calboli wrote:
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?

The LAB and LUV color spaces (in the colorspace package) attempt to map
perceptual differences to equal distances.  You could try using a grid
of points in one of those spaces, but not all triples are valid.

However, 21 colours is probably too many for your purpose.  If you
really want to distinguish 21 groups, you're likely going to have to use
other characteristics as well, such as the symbol.  You could plot 21
different letters in 5 different colours and it might work, but it's not
going to be easy for viewers.


The `alphabet` and `alphabet2` palettes from the `pals` package claim 26
"distinguishable" colours:

Details:

      The ‘alphabet’ palette has 26 distinguishable colors that have
      logical names starting with the English alphabet letters A, B, ...
      Z. This palette is based on the work by Green-Armytage (2010), but
      uses the names 'orange' instead of 'orpiment', and 'magenta'
      instead of 'mallow'.

There are some other palettes in that help page (?alphabet) that might also
work. But 21 colours is pushing it.

Barry






Duncan Murdoch


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@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.


______________________________________________
R-help@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.


        [[alternative HTML version deleted]]

______________________________________________
R-help@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.


--
Dr Paul Murrell
Department of Statistics
The University of Auckland
Private Bag 92019
Auckland
New Zealand
64 9 3737599 x85392
p...@stat.auckland.ac.nz
http://www.stat.auckland.ac.nz/~paul/

______________________________________________
R-help@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.

Reply via email to