Thinking about colors [Part 1 of 2]

Christopher R. Madan, PhD
4 min readAug 30, 2016

--

Some of you know that I did freelance graphics designing before I became a researcher. While I never was formally trained, I learned as I went. I think some of those skills are relevant to research — specifically, when making figures, posters, or talks.

Some colors go together better than others. The basics are that it’s usually good to choose a few colors that are ‘adjacent’ to each other in a color wheel, or are opposite of each other.

From http://www.springleafstudios.com/2015/12/complementary-colors.html.

While this is good background, there are still LOTS of colors to choose from! Others have already come up with good color palettes (i.e., sets of specific colors), so it would be best to use those, or at least be aware of them.

Not all color palettes are good — especially ‘jet’

Until recently, the default color palette in Matlab (and maybe also in some other things?) was jet. Jet’s spectrum goes across red — green — blue, as shown in the left-most panel below. The problem is that perceptually, some of these color transitions are more pronounced, rather than being a linear continuity as you would expect— this causes artifacts/biases in the interpretation of the data. (Also see: http://medvis.org/2012/08/21/rainbow-colormaps-what-are-they-good-for-absolutely-nothing/.)

From http://www.climate-lab-book.ac.uk/2016/why-rainbow-colour-scales-can-be-misleading/.

So, we need a color palette that is designed better from a perceptual standpoint.

ColorBrewer

ColorBrewer is a set of color palettes, primarily made by Cynthia Brewer (hence the name). These color palettes have since become well adopted and packages exist for integrated these colors into many software packages (Python, Matlab, d3, …lots of others!).

See here for more details on ColorBrewer:

Here is a rough diagram of the different color palettes in ColorBrewer:

Note that while some of these are designed for continuous data, others are designed for categorical data (‘qualitative’ above). I particularly like Set 1.

Here are implementations of ColorBrewer in a variety of software packages:

Matlab: https://github.com/DrosteEffect/BrewerMap

Python: https://github.com/jackparmer/colorlover

ggplot: http://docs.ggplot2.org/current/scale_brewer.html

d3: https://github.com/d3/d3-scale-chromatic

More on ColorBrewer: http://www.personal.psu.edu/cab38/ColorBrewer/ColorBrewer_updates.html

Other color palettes

Of course, there are other color palettes that also can be quite useful, here are two examples I like:

bipolarhttp://www.mathworks.com/matlabcentral/fileexchange/26026-bipolar-colormap

viridishttps://cran.r-project.org/web/packages/viridis/vignettes/intro-to-viridis.html, https://github.com/sjmgarnier/viridis, https://www.mathworks.com/matlabcentral/fileexchange/51986-perceptually-uniform-colormaps

See https://cran.r-project.org/web/packages/viridis/vignettes/intro-to-viridis.html.

Also see: https://bids.github.io/colormap/

Color blindness

The color palettes above are good, but most of them aren’t optimized to adjust for color blindness (the viridis set is! [https://cran.r-project.org/web/packages/viridis/vignettes/intro-to-viridis.html]). Below is a set of colors designed for use with categorical data that is optimized for still being as distinct as possible even for individuals with color blindness. The ‘original’ column represents how an individual without color blindness would see the colors, and the following three columns of colors represent simulations of how individuals with different types of color blindness would see the colors. (See the paper for further details.)

From Wong (2011, Nature Methods).

That’s all for this time! Hopefully you will find some of these color schemes useful in your future work! :)

End of Part 1

In this part I covered what I think is more generally useful to other researchers. In Part 2 I will talk about colors more broadly — technical considerations, as well as some more psychology-related insights.

--

--

Christopher R. Madan, PhD

Assistant Professor at the University of Nottingham, Psychology. Computational cognitive neuroscience. Memory; motivated cognition; brain morphology.