With this post I would like to introduce my new, perceptually balanced rainbow color palette. I used the palette for the first time in How to assess a colourmap, an essay I wrote for 52 Things You Should Know About Geophysics, edited by Matt Hall and Evan Bianco of Agile Geoscience.
In my essay I started with the analysis of the spectrum color palette, the default in some seismic interpretation softwares, using my Lightness L* profile plot and Great Pyramid of Giza test surface (see this post for background on the tests and to download the Matlab code). The profile and the pyramid are shown in the top left image and top right image in Figure 1, from the essay.
In the plot the value of L* varies with the color of each sample in the spectrum, and the line is colored accordingly. This erratic profile highlights several issues with spectrum: firstly, the change in lightness is not monotonic. For example it increases from black (L*=0) to magenta [M] then drops from magenta to blue [B], then increases again and so on. This is troublesome if spectrum is used to map elevation because it will interfere with the correct perception of relief, particularly if shading is added. Additionally, the curve gradient changes many times, indicating a nonuniform perceptual distance between samples. There are also plateaus of nearly flat L*, creating bands of constant color (a small one at the blue, and a large one at the green [G]).
The Great Pyramid has monotonically increasing elevation (in feet – easier to code) so there should be no discontinuities in the surface if the color palette is perceptual. However, clearly using the spectrum we have introduced many artificial discontinuities that are not present in the data. For the bottom row in FIgure 1 I used my new color palette, which has a nice, monotonic, compressive Lightness profile (bottom left). Using this palette the pyramid surface (bottom right) is smoothly colored, without any perceptual artifact.
This is how I created the palette: I started with RGB triplets for magenta, blue, cyan, green, and yellow (no red), which I converted to L*a*b* triplets using Colorspace transformations, a Matlab function available on the Matlab File Exchange. I modified the new L* values by fitting them to an approximately cube law L* function (this is consistent with Stevens’ power law of perception), and adjusted a* and b* values using Lab charts like the one in Figure 2 (from CIELab Color Space by Gernot Hoffmann, Department of Mechanical Engineering, University of Emden) to get 5 colors moving up the L* axis along an imaginary spiral (I actually used tracing paper). Then I interpolated to 256 samples using the same ~cube law, and finally reconverted to RGB .
There was quite a bit of trial and error involved, but I am very happy with the results. In the animations below I compare the spectrum and the new palette, which I call cubeYF, as seen in CIELab color space. I generated these animations with the method described in this post, using the 3D color inspector plugin in ImageJ:
I also added Matlab’s default Jet rainbow – a reminder that defaults may be a necessity, but in many instances not the ideal choice:
OK, the new palette looks promising, insofar as modelling is concerned. But how would it fare using some real data? To answer this question I used a residual gravity map from my unpublished thesis in Geology at the University of Rome. I introduced this map and discussed the geological context and objectives of the geophysical study in a previous post, so please refer to that if you are curious about it. In this post I will go straight to the comparison of the color palettes; if you are unfamiliar with gravity data, try to imagine negative residuals as elevation below sea level, and positive residuals as elevation above seal level – you won’t miss out on anything.
In Figures 3 to 6 I colored the data using the above three color palettes, and grayscale as benchmark. I generated these figures using Matlab code I shared in my post Visualization tips for geoscientists: Matlab, and I presented three of them (grayscale, Spectrum, and cubeYF) at the 2012 convention of the Canadian Society of Exploration Geophysicists in Calgary (the extended abstract, which I co-authored with Steve Lynch of 3rd Science, is available here).
In Figure 3, the benchmark for the following figures, I use grayscale to represent the data, assigning increasing intensity from most negative gravity residuals in black to most positive residuals in white (as labeled next to the colorbar). Then, I used terrain slope to create shading: the higher the slope, the darker the shading that is assigned, which results in a pseudo-3D display that is very effective (please refer to Visualization tips for geoscientists: Surfer, for an explanation of the method, and Visualization tips for geoscientists: Matlab for code).
In Figure 4 I color the pseudo-3D surface with the cubeYF rainbow. Using this color palette instead of grayscale allows viewers to appreciate smaller changes, more quickly assess differences, or conversely identify areas of similar anomaly, while at the same time preserving the peudo-3D effect. Now compare Figure 4 with Figure 5, where we use the spectrum to color the surface: this palette introduces several artefacts (sharp edges and bands of constant hue) which confuse the display and interfere with the perception of pseudo-relief, all but eliminating the effect. For Figure 6 I used Matlab’s default Jet color palette, which is better that the spectrum, and yet the relief effect is somewhat lost (due mainly to a sharp yellow edge and cyan band).
It looks like both spectrum and jet are poor choices when used for color representation of a surface, with the new color palette a far superior alternative. In the CSEG convention paper mentioned above (available here) Steve and I went further by showing that the spectrum not only has these perceptual artifacts and edges, but it is also very confusing for viewers with deficient color vision, a condition that occurs in about 8% of Caucasian males. We did that using computer software  to simulate how viewers with two types of deficient color vision, Deuteranopia and Tritanopia, would see the two colored surfaces, and we compare the results. In other words, we are now able to see the images as they would see them. Please refer to the paper for a full discussion on these simulation.
In here, I show in Figures 7 to 9 the Deuteranope simulations for cubeYF, spectrum, and jet, respectively. In all three simulations the hue discrimination has decreased, but while the spectrum and jet are now even more confusing, the cubeYF has preserved the relief effect.
That’s it for today. In my next post, to be published very shortly, you will get the palette, and a lot more.
A more perceptual color palette for structure maps, CSEG/CSPG 2012 convention, Calgary
How to assess a colourmap, in 52 Things You Should Know About Geophysics
 An alternative to the method I used would be to start directly in CIELab color space, and use a some kind of spiral *L lightness profile programmatically. For example:
– Using 3D helical curves from: http://www.mathworks.com/matlabcentral/fileexchange/25177-3d-curves
– Using Archimedes spiral
– Expanding on code by Steve Eddins at Mathworks (A path through L*a*b* color space) in this article , one could create a spiral cube lightness with something like:
%% this creates best-fit pure power law function % Inspired by wikipedia - http://en.wikipedia.org/wiki/Lightness l2=linspace(1,power(100,0.42),256); L2=(power(l2,1/0.42))'; %% this makes cielab real cube function spiral radius = 50; theta = linspace(0.6*pi, 2*pi, 256).'; a = radius * sin(theta); b = radius * cos(theta); Lab1 = [L2, a, b]; RGB_realcube=colorspace('RGB<-Lab',(Lab1));
 The simulations are created using ImageJ, an open source image manipulation program, and the Vischeck plug-in. I later discovered Dichromacy, anther ImageJ plug-in for these simulations, which has the advantage of being an open source plugin. They can also be performed on the fly (no upload needed) using the online tool Color Oracle.
Pingback: The rainbow is dead…long live the rainbow! – series outline | MyCarta
Pingback: Perceptual rainbow palette – the goodies | MyCarta
Pingback: Color palettes for seismic structure maps and attributes | MyCarta
The perceptual reason your method works has to do with the fact that magnitude perception is based on the luminance component of the color scale. Luminance “carries” magnitude information. The goal is for equal data steps to be perceived as equal perceptual steps, and this is well approximated by having the luminance component be monotonic. I love your figure showing the Rainbow (JET) colormap in L*a*b* space– this is obviously not a monotonic function in L*. In principle, you can create an infinite number of great color scales that will pass your Great Pyramid test– just keep the luminance component monotonic. Spirals, or sections of spirals are nice, since the hue changes smoothly; the heated-body colormap is a good example. But, the hue and saturation do not have to be continuous. In fact, for some applications, for example, if you want to highlight regions while still maintaining the structure, you might want to select hue and saturation values that do not vary smoothly.
You might be interested to check this out. Alan Kalvin and I tested a variation on your Great Pyramid test, the “Which Blair” method, in which we mapped various color ramps (created in various color spaces) onto an image of Tony Blair. Users could easily tell which colormaps had non-monotonic luminance profiles, since they produced very discernible distortions in the image.
Nice blog post. Thanks!
Thanks for the feedback. Being very familiar with your work, and having read many of your papers I was thrilled to read your comments and to see you liked my visualization of the rainbow in 3D L*a*b* space. The Blair which project paper (by the way, I love the title, always found it really funny) was a great source of inspiration and of ideas. When designing my cube function rainbow, I wanted colors to be pastel-like, not getting down all the way to black, and all the ay up to white, so I’ve used FIgure 8 from the paper as a way to decide if a total L* contrast of about 60 was acceptable (and I thought it did). When I presented my abstract from the paper A more perceptual color palette for structure maps
I actually showed the figure. And I regularly use it to assess other colormaps.
I also found the idea of using a face to test colormaps terrific, and I’ve also used that idea: I have not had a chance to write about this yet, but I’m using similar displays (with Canada’s Prime Minister Stephen Harper’s face, and Alfred Hitchcock’s) to argue that divergent color schemes that have white in the middle are a poor choice. I will keep you posted when I get to it.
I’ve also read your work with Treinish on task based colormaps and really like your hue-enhanced isomorphic colormap from Figure 8, and how it highlights data in the lower spatial frequency.
So, thank you for your research and for having shared your findings.
Pingback: Colormap compromise | MyCarta
Pingback: Logarithmic spiral, nautilus, and rainbow | MyCarta
Pingback: Picking a colour scale for scientific graphics | Better Figures
Pingback: Portfolio: epigenetic regulators and neurodevelopmental disorders – Shibui Graphics
Pingback: d3/d3 – News Webcast
Pingback: 10-year anniversary | MyCarta