Cats2D Multiphysics > Research Topics > Which color map should I use?

All unpublished results shown here are Copyright © 2016–2019 Andrew Yeckel, all rights reserved

Which color map should I use?

Not any color map will do

The rainbow color scale based on the visible light spectrum dominates scientific visualization despite its widely known flaws. Borland and Taylor describe the rainbow scale as "actively misleading" for the gradient artifacts that appear in the red to green, and green to blue transitions. The same field shown in gray scale and rainbow scale looks quite different because of these artifacts:

The field plotted here is linear, but the narrow bands of yellow and cyan in these transitions bias us to perceive large gradients in the field where none exist. This perception is encouraged by a poor separation of shades in the broad bands of the principal colors, red, green and blue. The greens are particularly murky and indistinct.

Most commercial simulation and visualization codes use some sort of modified rainbow scale to combat these artifacts. The scale can be made better by applying a nonlinear transform that compresses the greens and widens the yellow and cyan transitions. Here is something I cooked up by hand. It is far from perfect, but it is definitely an improvement:

Nevertheless, broad regions of red, green, and blue persist over which the variation of hue is slow and subtle. We can sharpen our perception of change by displaying discrete color levels instead of a continuously varying hue:

The gray scale also looks better broken into levels:

Whether it is instinctual, or conditioned by our frequent exposure to rainbow color temperature maps shown by weather forecasters, the rainbow scale works pretty well for displaying temperature contours. We commonly describe blue and green as "cool" colors and yellow and red as "warm" colors. Nevertheless, the perceptual ordering of hues is weak, and for many purposes the rainbow scale is simply wrong. Tufte shows a particularly ghastly example of its use on page 77 of his book Visual Explanations, where he converts a classic geographic map from its original shades of brown for land elevation and blue for ocean depth to a rainbow scale.

Whenever we are interested in displaying information relative to a datum, a two-hue diverging color scale is likely to work much better. I show here a simple bicolor scale obtained by varying saturation while holding hue and value constant in the HSV color model employed by Cats2D.

This is the scale I have been using lately to color streamline plots such as the animation of flow in a vertical Bridgman system shown in the entry just below. Compare that animation to this hideous attempt colored by the rainbow scale.

Let's take a look at a situation where we might choose either the rainbow or bicolor scale, a plot of the temperature distribution in a Bridgman ampoule. The plot on the left below shows rainbow and bicolor scales applied to the full range of temperature in the ampoule, which is 81.5 degrees C. For the plot on the right I've reduced the range to 50 degrees C to increase the contrast in color levels near the middle of the ampoule, at the expense of saturating the color levels at the hot and cold ends.

The rainbow scale is good at emphasizing the extremes of temperature, which is helpful if we are looking for hot and cold spots. Intermediate temperatures are poorly distinguished, however, making it problematic to identify the growth interface. In fact there would be no obvious way to see the interface except that I've switched contour shading from black to white there. In contrast, the bicolor scale strongly emphasizes the interface, at the expense of muting the perception of hot and cold extremes. Reducing the color range, as shown in the plot on the right, works well with the bicolor scale, but with the rainbow scale it does little to emphasize contrast near the interface while having a decidedly unpleasant impact elsewhere.

Inertia is tremendous. Though an internet search reveals a wealth of information on this problem and what to do about it, for example this nice round-up by Eddins at MathWorks, use of the rainbow color scale remains ubiquitous. This is yet another area in scientific computing lacking development of meaningful norms for quality and significance.

Moreland's "warm-cold" scale

A more sophisticated approach to designing a useful color scale based on human perception of color separation is described by Moreland. Here is my version of Moreland's warm-cold scale, obtained by fitting RGB data from Table 6 in his paper, and now a regular feature of Cats2D:

Here for comparison is my bicolor scale:

Moreland's scale differs from mine by varying the color value as well as saturation to achieve a more gray appearance towards the middle of the scale and deeper saturation at its ends. These scales superficially resemble one another in their general red-blue aspect, but they differ in a fundamental way. In the language commonly used to describe these things, my bicolor scale is a diverging scale, whereas the warm-cold scale is a sequential scale.

In this sense the warm-cold scale has more in common with the rainbow scale than it does with my diverging bicolor scale. The rainbow scale is a continuous progression from blue to green to red, whereas the warm-cold scale is a continuous progression from blue to gray to red (approximately). The bicolor scale, on the other hand, has a discontinuous change in hue at the midpoint, a jump from blue to red. Another way to look at it: Moreland replaces that ugly murky green with gray, whereas I just yank it out of there altogether.

Compare these lid-driven cavity stream function plots illustrated by these three color scales:

The rainbow scale shown on the left exhibits the usual nonlinear gradient artifacts in the yellow and cyan regions. The warm-cold scale shown in the center is obviously better in this regard, though the gray transition between hues remains somewhat suggestive of it. The diverging scale shown on the right suggests a steep gradient, almost a step change, making it wholly unsuitable for a plot of this type.

Besides avoiding gradient artifacts, the warm-cold scale also benefits from better color separation at the ends of the scale. This can be seen in the upper left corner of the lid driven cavity, where flow separation occurs at the wall, and also in the center of the main vortex. Adjacent color levels are much easier to distinguish in these areas in the warm-cold scale than the other scales. This can also be seen in the plots of temperature and flow topology in the vertical Bridgman system shown below. The difference between these color scales jumps out in these plots.

As with the rainbow scale, the warm-cold scale is worst at the center of the scale. This makes it problematic for situations in which a datum level such as the melt interface on the left, or separation streamlines on the right, is highly significant. The bicolor scale selectively emphasizes the datum level at the expense of color separation at the ends of the scale.

These next images show the mixing of two layers of liquid after three up and down cycles of a plunger. Considerable mixing has occured by this time. From left to right, concentration is represented by the warm-cold, bicolor, and rainbow color scales. The color scale is based on the initial condition of unmixed layers, so the concentration tends towards a uniform value of color as mixing occurs. We would like the color scale to distinguish areas of higher and lower concentration as long as possible for a better interpretation of the data.

Obviously the rainbow scale is terrible here. The bicolor scale is the pick of the litter this time, but the warm-cold scale performs well, too.