Last week I showed you the new MATLAB colormap, parula. Parula has replaced jet as the default colormap in R2014b, which was released earlier this month.
This week I want to explain some of the motivations for replacing jet. Jet is an example of a rainbow colormap. A rainbow colormap is based on the order of colors in the spectrum of visible light. Some of you might know the mnemonic "Roy G. Biv" for remembering the order of colors: red, orange, yellow, green, blue, indigo, and violet.
Multiple methods exists for constructing rainbow colormaps, so they don't all look alike. Here is jet, the MATLAB version:
In my introductory post last week, I showed you a few visualization examples using jet, and I asked you some questions about them. Let's look at the questions again and figure out the answers.
Question 1: In the chart below, as you move from left to right along the line shown in yellow, how does the data change? Does it trend higher? Or lower? Or does it trend higher in some places and lower in others?
fluidJet hold on plot([100 160],[100 135],'y','LineWidth',3) hold off colormap(gca,'jet')
By my count there are six very distinct color changes as you move along the line from left to right. So what does that mean about the data?
I posed this question to someone who is very familiar with the jet colormap, and I was surprised by the response: "The data starts low, goes high, and then goes back low again."
"But what about all those other color stripes," I asked? "What do they mean?"
"That's just what jet does. I've learned to ignore all those stripes."
Oh! Well, it turns out that some of the color stripes are indeed mostly meaningless. But not all of them!
Here's what the data actually does along that path.
improfile(s.X,[100 160],[100 135])
Yes, the data starts low, goes high, and then goes back low. But if you ignore all the color stripes in between the blue and the red, then you miss the presence of the smaller-magnitude peak on the left. Alternatively, if you believe that all the color stripes are meaningful, then the yellow stripes seem to falsely suggest distinct data regions to the left and the right of the main peak.
Now let's compare with parula.
fluidJet colormap(gca,parula) hold on plot([100 160],[100 135],'y','LineWidth',3) hold off
You can see that now there are only four distinct color changes as you follow the yellow line. These changes correspond directly to real features in the data. There are no extraneous color stripes that do not correspond to real data features.
Question 2: In the filled contour plot below, which regions are high and which regions are low?
In the plot above, I have done a crude simulation of what a jet-based visualization looks like if printed on a grayscale printer. Here's the full color version:
If you are familiar with jet and know therefore that blue is low and red is high, then you can probably look at the full-color version and give a reasonable interpretation of it. When rendered as grayscale, however, all hope is lost. The red and blue colors of jet are just about equally dark.
Here are the full-color and grayscale results with parula.
With parula, dark consistently means low, and bright consistently means high.
The last questions relate to the three plots below (A, B, and C) showing different horizontal oscillations.
Question 3: Which horizontal oscillation (A, B, or C) has the highest amplitude?
Question 4: Which horizontal oscillation (A, B, or C) is closest to a pure sinusoid?
Question 5: In comparing plots A and C, which one starts high and goes low, and which one starts low and goes high?
subplot(2,2,1) horizontalOscillation1 title('A') subplot(2,2,2) horizontalOscillation2 title('B') subplot(2,2,3) horizontalOscillation3 title('C') colormap(jet)
The answers are subjective and might depend on your monitor and ambient lighting. But here's what I see.
The data pattern in image A has significantly higher visual contrast than either image B or image C. That suggests that the data oscillation in A has the highest amplitude.
The data patterns in images B and C both exhibit vertical stripes within each period of the oscillation. That strongly suggests that horizontal oscillations shown in B and C have some constant or almost-constant regions and that they go up and down in something like a stair-step pattern. To my eye, image A looks the most like a pure sinusoid.
And finally, the pattern in image A starts with a bright stripe on the left, whereas the image B pattern starts with a dark stripe. That suggests that oscillation A starts high, while oscillation B starts low (or maybe vice versa).
You probably won't be surprised to find out that these are all trick questions. Actually, oscillations A, B, and C are all sinusoids with exactly the same amplitude and shape. They differ only in their constant offsets, which place them in different regions of the jet colormap. Note especially that oscillations A and C are actually in phase with each other; they both start high and go low. The differences we see are all visual artifacts caused by the jet colormap.
Compare the result using parula:
With these examples, I wanted to show several ways in which the jet colormap, and rainbow colormaps in general, can mislead the viewer about properties of the data.
It turns out that some people have been writing about these problems with rainbow colormaps for years. Here's a summary of the main criticisms:
- Rainbow colormaps confuse viewers because there is no natural perceptual ordering of the spectral colors. In addition to causing visual confusion (such as whether oscillations A and C above are in-phase or out-of-phase), the lack of perceptual ordering can slow down tasks because viewers have to refer to the color key more often in order to interpret the data.
- Rainbow colormaps obscure small details in the data. The primary reason is that the green and especially the cyan sections of the rainbow colormap are perceptually indistinct, which makes the data in the corresponding ranges appear to be uniform or flat. (I haven't shown examples of this in the blog, yet, but there are examples in the technical paper mentioned below.)
- Rainbow colormaps mislead viewers by suggesting data features that are not really there. These "phantom features" often take the form of false boundaries. This effect, in combination with perceptually indistinct green or cyan regions, can falsely segment the data.
- Rainbow colormaps lose critical information about high and low data values when displayed or printed on a gray-scale device.
- Rainbow colormaps can be difficult to interpret for some color-impaired viewers.
For a much more detailed summary of the literature and online sources regarding rainbow colormaps, see the paper "Rainbow Color Map Critiques: An Overview and Annotated Bibliography" on mathworks.com.
Next time I'll starting getting into colormap construction principles.
Get the MATLAB code
Published with MATLAB® R2014b
Comments are closed.
18 CommentsOldest to Newest
I can look at this image and see that there are low concentration bands that run north and south of the equator. I can see that there are high concentrations along the edges of many of the continental land masses. The colors tell me this. Close examination of the color key at the bottom is not necessary for me to make this interpretation. The color is not there mainly for beautification, although I do think the colors are beautiful. If there is no color variation in the visualization above, then there is simply nothing to see at all.
Your contention that there is a blue-to-red color ordering that is physically intuitive to all humans is not borne out by the studies. Yes, a particular individual often will consistently order spectral colors in a way that seems intuitive to that person, but this ordering is not universally consistent from individual to individual. Brightness, however, is almost universally perceived as a consistent way to order colors. The parula colormap monotonically increases with brightness. Exploiting brightness variation also works much better for color-impaired viewers (and there are many of them!) than the spectral colors.
I have seen many examples of visualizations based on jet/rainbow colormaps that actually mislead the viewer about the underlying data. I've seen digital elevation models in which a smoothly rounded hill looks like a flat-top plateau with a cliff drop-off. I've seen fine spatial detail completely obscured by the perceptually flat regions of the jet colormap.
A user who saw an early MATLAB preview with the new colormap complained to us that the new colormap was "noisy." In reality, it was the underlying data that was noisy. The jet colormap hid the noise, while the parula colormap revealed it.
I have written a paper on mathworks.com that summarizes many of the published literature and online sources of information about the use of rainbow colormaps. One paper found that radiologists made fewer diagnostic errors when using a perceptually uniform colormap when compared to using the rainbow colormap, despite the fact that most of those radiologists were more familiar with and comfortable with the rainbow colormap.
We recognize that a change in software behavior such as this can cause problems. However, for the reasons described above and elsewhere, we felt that the significant improvement in data visualization was worth it.
I've been following the reaction to the colormap change among a community of oceanographers and climate scientists. The general consensus there seems to be, "What took you so long?" An electrical engineering professor said, "I was just this week looking at a jet-colormap surface produced by one of my students, and I felt like the jet colormap totally obscured my ability to interpret what was really going on."
On the other side, I must admit, I did see one scientist on Twitter give parula a one-word review: "Yuck."