I need to draw n different objects on a chart. I want to pick a different color for each of them to make them distinguishable. The objects will be moved around, so I cannot count on ideas like "four color theorem" to assign same color to non-adjacent items. So far my problem call for up to 20 different items.
Is there a good way to pick n different colors to make them as distinguishable from each other as possible?
Objects appear different colours because they absorb some colours (wavelengths) and reflected or transmit other colours. The colours we see are the wavelengths that are reflected or transmitted.
In R, colors can be specified either by name (e.g col = “red”) or as a hexadecimal RGB triplet (such as col = “#FFCC00”). You can also use other color systems such as ones taken from the RColorBrewer package.
First of all, I have since changed the design so that it is not important to use 20 distinct colors. The default palette of 10 colors show up quite well.
Secondly, I've found an answer to my own question. The thing I want to do is called Color scale for categorical coding. Here is a paper that propose a method to do it
An algorithm for generating color scales for both categorical and ordinal coding - Breslow - 2009 - Color Research & Application - Wiley Online Library http://onlinelibrary.wiley.com/doi/10.1002/col.20559/full
I'm going to give the paper a glance. It is probably too technical than what I prepare to do.
I'd say colour distinction is a very subjective matter and you're probably better off looking for an existing colour palette and working your way from there. The higher your n, the higher your chance of two automatically generated colours being indistinguishable by your users even though by some colour-theoretic criterion they are very different.
And don't forget to make sure you don't use colour as the only distinction between objects, or:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With