I use colors a lot in preparing data visualizations.  This post mostly serves to collect together the various resources I use when choosing color schemes for particular visualizations or other tasks.

§ General Considerations

When choosing a color scheme, there are a number of different considerations it’s useful to keep in mind.  Some of the things I consider are given below; this is mostly to provide context for why I like the color schemes I like.

# Type of Color Schemes

Color schemes are generally designed around particular use cases, which are often largely determined by the nature of the data being visualized.

Categorical color schemes are used when the data is represented as several distinct things and you just need to be able to tell those things apart.  One common example is when you have a line graph with several lines representing different trends over time.  You need to be able to tell which line on the graph corresponds to a particular category, so each color should be distinct from all the others.  Another example would be a map where different areas have different characteristics, such as election maps where you want to represent the party of the candidate that won in each district.

Linear color schemes are used when you want to represent data that varies along some numeric continuum.  For example, you might want to color points on a map according to their temperature.  Cooler temperatures would get one color, warmer temperatures would get another, and the temperatures in between would get colors in between.

Diverging color schemes are similar to linear schemes, but they’re used when there’s some central numerical value for the data and you want to represent deviations from that central value.  For example, if you had a map showing an election between two candidates, you could use a diverging color scheme to show the strength of each district’s support for its winning candidate.  A district that went strongly for one candidate would get one color.  A district that went strongly for the other candidate would get a different color.  A district that was evenly split would get the central, neutral color.

Circular color schemes are used for data that either cycles around or repeats itself.  For example, wind direction can be considered circular; the wind might come from a direction anywhere from 0° to 359°, but 0° and 359° are very close to each other and should have colors that are similarly very close to each other.

Linear, diverging, and circular schemes can be either continuous or segmented.  When used continuously, every separate data point gets its own, specific color.  A value in a linear color scheme 26.5% of the way between the two endpoints will get a color 26.5% of the way between the two endpoints’ colors.  If the color scheme is segmented, the data is divided into separate groups (often called bins or buckets) and each group gets its own color along the gradient.  For example, if you used a 10-bin division of the data space, the 26.5% value would get the same color as every value between 20% and 30% (and that color would probably be something around 25% of the way between the two endpoints’ colors).

# Things to Care About in Color Scheme Design

There are several things that are important to consider when choosing a good color scheme.  Different use cases will have different criteria; characteristics that are important for a categorical map will be different from those important to an elevation model.

It should be easy to identify distinct states in the color scheme.  For a categorical scheme, every color should be distinct from all the others.  For linear schemes, at least the endpoints should be distinct from each other.  For a diverging scheme, the two endpoints and the midpoint should all be distinct from each other.

In some cases, there is semantic meaning to particular colors as they relate to the data being displayed.  You should choose colors with meaning congruent to the data or, at least, avoid colors that would be counterintuitive.  For example, you probably shouldn’t use a scheme that uses red for safe values and green for dangerous values.

You should take into account the potential limitations of people viewing your visualization.  For example, many people have red-green color blindness; a color scheme that goes only from red to green hues will likely not be very useful to such people.

You should also take into account limitations of your medium.  If your visualization will be printed on black and white printers, for instance, you will need to make sure the colors are distinct even if there’s no hue, just lightness and darkness.

Color schemes should be perceptually uniform.  The human eye does not perceive colors uniformly.  For instance, green light often appears brighter to us than blue light of the same physical brightness.  In computer terms, the RGB color #00FF00 feels much brighter then #0000FF.  Many color schemes are carefully designed so that as you move along the scheme’s color gradient, it feels like the brightness changes in proportion to the numeric difference.  If a color scheme has not been designed with human perception in mind, the same numerical difference can feel different depending on which part of the gradient they span.

Non-categorical color schemes should feel like there’s a natural order to them.  If you take two colors from anywhere on the gradient, the one that feels like it’s “more” than the other should always point in the same direction.

§ Resources

With the considerations for color choice out of the way, we can now move on to the various resources I use when choosing colors to use for a project.

# ColorCET

URL: https://colorcet.com/
Author: Peter Kovesi.

ColorCET consists of a large number of perceptually uniform gradients for a variety of different scenarios.  There are linear, diverging, and circular gradients with several different hue transitions.  There are several schemes designed for more specific purposes, like ones for geographic elevation mapping, or the set of red, green, and blue gradients intended for putting three separate data channels into a single RGB image.

Although the schemes are all designed to be perceptually uniform, only a small subset are designed around broadly-applicable utility for color blindness.

I tend to default to ColorCET because the variety of schemes means there’s usually something available that has a combination of hues particularly suited to the use case I have in mind.

# Scientific Colour Maps

URL: https://www.fabiocrameri.ch/colourmaps/
Author: Fabio Crameri

Fabio Crameri’s scientific color maps are all developed with color blindness in mind and should be accessible across a wide array of vision differences.  There are linear, diverging, and circular gradients, as well as adaptations of the color schemes to categorical use.  There are also some “double diverging” color schemes; I can’t comment too much on them, since I’ve never found a need for that sort of scheme myself.

The color schemes are all use fairly muted colors.  The intent is that these would be used for visualizations in published papers or as part of some other, larger work.  The colors are designed to blend in with surrounding text.  Crameri argues that many other color schemes draw too much attention to the visualizations that use them because their colors are more vivid than the text they’re supporting.

There are several different color schemes here.  When I use something from here, I mostly just use “batlow” or one of its variants; none of the other schemes feel distinct enough to warrant me choosing them over that default.

# cmocean

URL: https://matplotlib.org/cmocean/
Author: Kristen Thyng

The cmocean color schemes are, in many cases, based on Matplotlib colormaps, but they’ve been adjusted to be perceptually uniform.  The various colormaps are chosen and named according to common color schemes for particular oceanographic visualizations.  For instance, the “thermal” map has colors commonly used in oceanic temperature visualizations.

# Paul Tol’s Colour Schemes

URL: https://sronpersonalpages.nl/~pault/
Author: Paul Tol

Paul Tol works on visualization of geodata from satellite observations.  He’s developed a number of different color schemes for use in websites and papers.  These color schemes are perceptually uniform and color blind safe.

A number of the schemes include a separate color specifically intended to represent points with no data available.

I rather like these schemes.  There aren’t too many to choose from, which avoids some of the decision paralysis some other collections engender.  The colors are also relatively simple; the schemes feel more natural to me than, say, Fabio Crameri’s colors.  I’ve been making more use of these colors over time, especially for categorical data.

# ColorBrewer

URL: https://colorbrewer2.org/
Author: Cynthia Brewer

ColorBrewer is a classic of the genre, if you will.  It was originally developed in the very early 2000s to provide a number of color schemes intended for coloring map areas.

The color design assumes quantized data buckets.  None of the color schemes are continuous; their maximum number of distinct colors ranges from nine to twelve (and, frankly, the twelve-color schemes are pushing the boundaries of being visually distinct).  The linear color maps are perceptually uniform.  Not all of the schemes are color blind or black-and-white printing safe, but the website makes it pretty easy to select the ones that are.

I used to use this site all the time.  Now I’m more likely to use ColorCET or Paul Tol’s colors than ColorBrewer, but I do occasionally come back here, particularly for map-related visualizations.

# Viridis

URL: https://cran.r-project.org/web/packages/viridis/vignettes/intro-to-viridis.html
Authors: Bob Rudis, Noam Ross, and Simon Garnier

Viridis is both a collection of color maps and the name of the principal map in the collection.  All of the color schemes in the collection are perceptually uniform and color blind safe.

The viridis colormap is the default in Matplotlib.  (It was made the default in the Matplotlib 2.0 release).

The cvidis colormap is designed for functionality across a wide range of vision color deficiencies.

The turbo colormap is a rainbow colormap aimed at being a perceptually-uniform alternative to Jet.  It covers all the hues of a rainbow, with greater lightness in the center and lower lightness at each of the two ends.  It’s intended for uses where you don’t necessarily care about linear color ordering so much as identifying parts of the image with the same values as each other.  It’s not strictly color blind safe, but it’s better than some alternative rainbow schemes.

I have on occasion used the turbo colormap for visualizing depth maps.

# 20 Simple, Distinct Colors

URL: https://sashamaps.net/docs/resources/20-colors/
Author: Sasha Trubetskoy

This is a set of twenty colors designed to be visually distinct from each other while covering most of the useful hues of the rainbow.  There are options for limiting the selection to color blind safe palettes, though you end up with fewer usable colors.

These are only really useful for categorical data.  They’re not perceptually uniform.  The author doesn’t even use them for their original purpose, having found a better approach that used fewer colors overall.

In general, I tend to default to Paul Tol’s color schemes for categorical data before I reach for these.  I do, however, like Sasha’s color names.  When I need to pick colors that correspond to a number of specific names, I find this is a useful resource.

# Reasonable Colors

URL: https://www.reasonable.work/colors/
Author: Matthew Howell

Reasonable Colors comprises a set of colors designed principally for websites, through they’re applicable more broadly, too.  It consists of a set of twenty-four hues evenly distributed across a perceptual color space, plus gray.  Each color has six shades.  The shades are perceptually matched, so the, say, third shades of two different colors will have the same lightness (or darkness) levels.

I’ve used these colors for website design, including for choosing some of the colors for this website.  I also sometimes use these when matching named colors, though my usual resource for those is Sasha Trubetskoy’s color collection, mentioned above.

# Color Map Advice for Scientific Visualization

URL: https://www.kennethmoreland.com/color-advice/
Author: Kenneth Moreland

This page discusses a number of different colormaps, but the main reason I want to link to it is its Fast color scheme.  The Fast scheme provides a blue-white-red diverging colormap where the white in the middle covers a fairly narrow band of data.  It’s very useful for visually locating the transition bands between the two halves of the colormap.

The Fast map in particular is designed to be useful when applied to a 3D surface.  I have yet to use any colormap in that manner, but I appreciate some of the other qualities of the scheme.

# Tree Colors: Color Schemes for Tree-Structured Data

URL: https://doi.org/10.1109/TVCG.2014.2346277
Authors: Martijn Tennekes and Edwin de Jonge

This isn’t a color scheme, but a coloring algorithm designed to make coherent but visually distinctive categorical palettes for hierarchical tree-structured data.  I have used this algorithm for coloring treemaps.

Broadly speaking, the algorithm assigns different hues to different branches of the tree, and chooses the hues so adjacent branches will have distinct colors.  The color saturation increases from the root out to the leaf nodes, so it’s an indicator of the depth of a given node.