Default colormaps: Are Parula and Viridis really an improvement over Jet?

Jet was a ubiquitous colourmap that slowly fell out of fashion over the last five years. It was the default colourmap for Matlab and Matplotlib (and probably others) until 2015ish. The replacements, Parula and Viridis, respectively, get a lot of love. A quick Google search will present numerous blog posts and articles maligning Jet and promoting the use of these newer colourmaps. It’s an unpopular opinion but, especially now that they are common and overused, I dislike Parula and Viridis as much as I dislike Jet.

parula_viridis

To the surprise of my former self, I sometimes find myself typing colormap(jet) or cmap='jet'. I won’t publish a figure using Jet, but for interactive use and quick plots, it can come in handy. When the default colourmap is Parula or Viridis, I feel as if I’m limited to three different colours: blue, teal, and yellow. The colours in the centre of the colourmap are barely distinguishable. With Jet, I can at least discern several colours. Although this issue can be negated somewhat by discretising the colourmap, the result is still less attractive than it could be:

discrete_vs_continuous
Discrete colourmaps make distinguishing patterns and quantities much easier. For example, test yourself to see how well you can guess the value within the square.

The primary criterion in developing Parula and Viridis was to ensure the default colourmaps are perceptually uniform. One way to interpret this is that it means that if the colourmap is converted to grayscale, it should be linear. Parula and Viridis certainly achieve that, albeit with a limited range between light and dark for Parula.

grayscale_parula_viridis

Another criterion for Parula and Viridis is that they be colourblind-friendly, as in there should be no possibility for red–green confusion. From what I’ve read, the colourmaps achieve this. (Though this question on Stats StackExchange from a colourblind user implies Jet’s contrast can outweigh Viridis’s benefits.)

The issue I have with these criteria is that they could be equally well satisfied by a simple grayscale colourmap. Of course, a piece of software that defaults to grayscale would be a hard sell in the 21st century. (But there is some merit in the idea, if only because it would more likely force users to forgo the default and think about what to use instead.)

Ok, so no grayscale default. But what about a monochromatic colourmap? It’s just like grayscale, but with a touch of colour and more aesthetically pleasing:

monochromatic

I’m starting to contradict myself. I’m promoting monochromatic colourmaps, yet earlier I was complaining about the lack of distinction in Parula and Viridis. This hypocrisy alludes to the challenges of creating colourmaps. It’s part art, part science. And it raises the question of how much, as scientists, we need to know about colourmaps.

Scientists don’t need to reinvent the wheel when it comes to colourmaps. We shouldn’t have to think about all the low-level details about their construction like bezier interpolations or lightness corrections. That would be like a fisherman knowing how to manufacture a fishing rod. Such details are irrelevant to catching a fish. But the fisherman does need to know the right equipment to buy. Similarly, scientists should have a working understanding of (i) colour-mapping tools available, (ii) what is meant by sequential, diverging, and qualitative colourmaps (iii) how to manipulate existing colourmaps, and (iv) what colour combinations readers generally appreciate.

As colour figures started to become commonplace in the 90s, tools were developed by visualisation experts to simplify the use of colourmaps for everyone else. A well-known tool is ColorBrewer, developed by Cynthia Brewer (whose surname lends itself perfectly to the tool) and others. As the developers of ColorBrewer note, it is designed for those who want to present their data well, but for whom professional demands leave little time for learning how to specify colour. I’ve been using ColorBrewer sporadically for many years now, but only recently did I read the scientific papers charting its development.

The first thing you realise while reading Brewer et al. (1997, 2004) is how much thought actually goes into creating a colourmap. It’s far from an automatic process. Sometimes the first hurdle is simply naming the colours to be used. In the 1997 paper, for example, they necessarily begin by selecting hues that avoid naming confusions. People will agree that red is red and blue is blue. But one person’s lime may be another person’s yellow–green. And as for brown, if you’ve ever mixed several paints, you know how ambiguous the name ‘brown’ is.

Once colours are suitably defined, the next hurdle is just as subjective: picking colour combinations that people find aesthetically pleasing. The 1997 paper lists 10 hues in order of preference among a test audience. Blue and purple–blue top the list, whereas orange and yellow lie at the bottom. Although red is also in the bottom half, a multi-hued scheme involving yellow and red tested favourably. If that’s not subjective enough, throw in the complication that the colour schemes people found pleasing changed depending on the amount of clustering in the map they were looking at.

In spite of the limitations imposed by possible colour naming confusion and the subjectivity of what is aesthetically pleasing, ColorBrewer develops numerous attractive, perceptually uniform, and easily distinguished colourmaps. (Well, at least most are attractive; maybe not the scheme where one side is pink and the other is yellow–green.) The schemes are divided into three types: diverging, sequential, and qualitative.

cmap_types

As an aside, ColorBrewer also effectively contains attractive variants of Parula and Jet. In fact, to the surprise of ColorBrewer’s developers, the spectral scheme not only rated well for pleasantness with their test audience, but was also effective when used in a map-reading task.

cbrewers_variants

Sequential colourmaps come in two varieties: the monochromatic schemes I mentioned earlier and multihued schemes. Example of the latter include purple-to-blue or the Yellow-to-Orange-to-Brown shown in a figure above. Such schemes are usually my go-to choices. The variation in hues provides more contrast, making different parts of the colourmap easier to differentiate. That said, monochromatic schemes still serve a purpose.

When multiple colourmaps are needed for a single figure, monochromatic schemes are often the best choice. They are similar yet distinct and many options are available. Conversely, imagine that you need two colourmaps for a figure and you first choose Parula or Viridis. What would you pick as the second colourmap? It would be easy to pick something distinct, but it would be challenging to pick something that pairs nicely.

In a paper I’m currently preparing, I need to display the ocean’s near-surface temperature structure on three different days together with the respective gradients for each. This requires 3 × 2 = 6 different colourmaps. (The ranges differ between the three days, so I can’t use the same colourmap twice.) However, I want it to be clear that among the six panels, there are only two quantities: temperature and temperature gradient. To achieve this, I use hot colours (reds and oranges) for the temperature and cool colours (blues and greens) for the temperature gradient:

temp_and_gradient

Brewer et al. (2004) note that their catalog of schemes should be used flexibly. Part of a scheme may be omitted, and schemes may be combined to build customized schemes. This is what I did in the figure above. Although ColorBrewer has three hot monochromatic colourmaps (simply named Reds, Purples, and Oranges), it has only two cool ones (Blues and Greens). Consequently, I created a third cool map by averaging the Blues and Greens. (And for good measure I actually did the same with Reds and Oranges, rather than using Purples).

Only so much manual adjustment of colourmaps is feasible. For example, I altered the three hot colourmaps in the figure above to increase the darkness level on the right-hand side so as to introduce a little more contrast. I expected this to be a reasonably straightforward process, especially in hsl colourspace. Instead, it required a lot of trial and error and I’m still not sure that the end result looks quite right. But further trial and error is likely beyond the point of diminishing returns. Even the ColorBrewer developers ran into a similar type of problem. When taking the time to perfect a colour scheme, they sometimes ended up with a result inferior to the initial draft design based on how their test audience scored on map-reading tasks.

Ultimately, what’s considered a good or appropriate colourmaps is always going to be somewhat subjective. But a little thought, or at least some trial and error, will go a long way to improving the final figure. Indeed, consider default colourmaps to be like Swiss Army Knives. They may suffice in many situations, but they’re seldom the best tool for a particular job. Instead, get to know what existing colourmaps are available. Or, if your feeling particularly creative, try developing your own. But this can be tricky, so I recommend this interactive tool that deals with lots of little colour-related issues so that you don’t have to.

Author: Ken Hughes

Post-doctoral research scientist in physical oceanography

One thought on “Default colormaps: Are Parula and Viridis really an improvement over Jet?”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s