Origins of Colormaps

Steve Eddins has recently posted a series in his blog about colormaps. I want to add one more post. With release R2014b, we are retiring jet as the default colormap, after many years of faithful service. But did you ever wonder where jet originated, and how it came to be the default? And did you ever come across colormaps like pink and bone?

Contents

Color maps

MATLAB first began to fully support color and 3D graphics with release 4.0 in 1992. Graphics hardware at the time had a limited amount of memory and so could only display a limited number of colors in any one figure. All color graphics went through color maps. Even the colors in full color photographs had to be quantized into a few bits.

Pseudocolor applies to the display of quantities, such as mathematical functions, that do not have any inherent color. Here the colormap interprets properties such as height, density or velocity as color. For example, the MathWorks logo, the L-shaped membrane, is the solution to a partial differential equation. As such, it does not have any color. A colormap, together with lighting and shading, makes it visually interesting.

jet

The image behind the jet colormap comes from astrophysical fluid dynamics calculations made at NCSA, the National Center for Supercomputer Applications at the University of Illinois. I found the image on the Internet in the very early days of the Internet, possibly even before the availability of the Mosaic web browser, coincidentally also developed at NCSA in 1993. Astrophysicists Larry Smarr and Mike Norman were among the prominent researchers at NCSA.

The image is available in the MATLAB demos directory.

   clear
   load flujet
   whos
   snapnow

   caption
  Name           Size              Bytes  Class     Attributes

  X            400x300            960000  double              
  caption        2x32                128  char                
  map           64x3                1536  double              

caption =
Astrophysical jet from NCSA.    
One fluid collides with another.

The 400-by-300 array X contains values of fluid density that have been quantized to "flints" (floating point integers) in the range from to 1 to 64. These serve as indices into the 64-by-3 array map, which is our jet colormap. The doubles in map range from 0.0 to 1.0 and specify the brightness of the red, green, and blue components of each pixel.

   image(X)
   colormap(jet)
   axis image
   axis off

Even though jet was originally given as an array of 64-by-3 numbers, it is actually a piecewise linear function of row index with breaks at 1/8, 3/8, 5/8, and 7/8 of the length. Jet is a variant of the "rainbow" color maps whose faults Steve describes.

   rgbploter(@jet)

hot

Here is another simple piecewise linear color map associated with black body radiation. It accurately describes the color obtained when a chisel made from high-carbon tool steel is heated with an oxy-acetylene torch. See the web page of Don Dougan, Sculptor. I learned about this map many years ago from Neil Ostlund, a chemistry professor at the University of Waterloo who started Hypercube, Inc., a company that did molecular modeling on the Intel iPSC.

   clf
   image(X)
   colormap(hot(64))
   axis image
   axis off
   rgbploter(@hot)

pink

Shortly after we introduced colormaps, I was sitting at a terminal demonstrating them to someone and I realized that the maps were just matrices. I could do array operations on them. I typed something like this.

   p = sqrt((2*gray(64) + hot(64))/3);

Taking the square root of a color map! Wow, that's pretty strange. But the result was useful. A better name than "pink" would be "sepia". Here's an old photo I've used many times, tinted to make it look old.

   clf
   load gatlin
   image(X)
   colormap(pink(64))
   axis image
   axis off
   rgbploter(@pink)

bone

This spine X-ray was high resolution back in the day. To get a colormap that looks like old X-ray file, interchange the blue and red columns of hot and then moderate it with gray.

   b = (7*gray(64) + fliplr(hot(64)))/8;

   clf
   load spine
   image(X)
   colormap(bone(64))
   axis image
   axis off
   rgbploter(@bone)

spring

We have colormaps named for all four of the seasons. They're all simple linear functions of the row index, like this spring.

The peaks function has proved to be remarkably popular for testing and demonstrating our 3D graphics. It's a modification of something I first saw back in my hypercube days from folks whose names I don't remember at Tektronix in Beaverton, Oregon. They were thinking of nearby Mount St. Helens.

   clf
   peaks
   colormap(spring(64))
 
z =  3*(1-x).^2.*exp(-(x.^2) - (y+1).^2) ... 
   - 10*(x/5 - x.^3 - y.^5).*exp(-x.^2-y.^2) ... 
   - 1/3*exp(-(x+1).^2 - y.^2) 
 
   rgbploter(@spring)

parula

Let's see how the old astrophysical jet looks with the new default colormap. For discussion of parula, including many reader's comments, see Steve's blog.

   clf reset
   load flujet
   image(X)
   axis image
   axis off
   rgbploter(@parula)

By the way, if you want to see a list of all the colormaps, type

help graph3d




Published with MATLAB® R2014b

|
  • print

Comments

To leave a comment, please click here to sign in to your MathWorks Account or create a new one.