-
Notifications
You must be signed in to change notification settings - Fork 61
Description
Colorcet currently includes only continuous color spaces, but it was created while working on Datashader, which uses both continuous and categorical sets of colors. For rendering categorical data, Datashader requires having a distinct color per category, and it includes some ad-hoc collections of colors to try to get enough distinct colors to deal with complex datasets.
A principled approach for designing arbitrarily large sets of mutually distinct colors was presented in:
Glasbey, Chris; van der Heijden, Gerie & Toh, Vivian F. K. et al. (2007), "Colour displays for categorical images", Color Research & Application 32.4: 304-309.
"Glasbey" colors are available in ImageJ and for R, and there is a Python implementation of the method. Generating the colors with the Python code is time consuming, so it would be convenient to generate one or more large sets of Glasbey colors and distribute them in colorcet.
Here's an example of generating 257 colors, which took about 5 minutes to run:
pip install colorspacious
git clone https://github.com/taketwo/glasbey.git
cd glasbey
python glasbey.py --view 257 --format float output.csv
You can click on the image to see it in more detail. The resulting list of color triples can easily be added to colorcet:
1.000000,1.000000,1.000000
0.000000,0.000000,0.000000
0.843137,0.000000,0.000000
0.549020,0.235294,1.000000
...
0.462745,0.160784,0.286275
0.741176,0.898039,0.000000