Perceptual rainbow palette - Matlab function and ASCII files
In my last post I introduced cubeYF, my custom-made perceptual lightness rainbow palette. As promised there, I am sharing the palette with today’s post. For the Matlab users, cube YF, along with the other palettes I introduced in the series, is part of the Matlab File Exchange submission Perceptually improved colormaps.
For the non-Matlab users, please download the cubeYF here (RGB, 256 samples). You may also be interested in cube1, which has a slightly superior visual hue contrast, due to the addition of a red-like color at the high lightness end but at the cost of a modest deviation from 100% perceptual. I used cube 1 in my Visualization tips for geoscientists series.
Another example
In Comparing color palettes I used a map of South America [1] to compare a linear lightness palette to some common rainbow palettes using grayscale as a perceptual benchmark. Below, I am doing the same for the cubeYF colormap.

Comparison of South America maps using, from left to right: ROYGBIV (from this post) , classic rainbow, cubeYF, and grayscale
Again, there is little doubt in my mind that cubeYF does a superior job compared to the other two rainbow palettes as it is free of artefacts [2] and more similar to grayscale (with the additional benefit of color).
The ROYGBIV and cubeYF map have been included in Marek Kultys’ excellent tutorial Visual Alpha-Beta-Gamma: Rudiments of Visual Design for Data Explorers, recently published on Parsons Journal for information mapping, Volume V, Issue 1.
An online palette testing tool
Both cubeYF and cube1 feature in the colormap evaluation tool by the Data Analysis and Assessment Center at the Engineer Research and Development Center. If you want to quickly evaluate a number of palettes, this is the right tool. The tool has a collection of many palettes, organized by categories, which can be used on 5 different test image, and examined in terms of RGB components and human perception. Below here is an example using cube YF.
An idea for a palette’s mood test
A few weeks ago, thanks to Matt Hall (@kwinkunks on twitter), I discovered Colour monitor, a great online tool by Richard Weeler (@Zephyris on twitter). You supply an image; Colour monitor analyses its colors in terms of hue, saturation and luminance and produces a graphical representation of the image’s mood [3]. I thought, what a wonderful idea!
Then I wondered: what if I used this to tell me something about a color palette’s mood? The circular histogram of colors reminded me of the Harmonic templates [4] on the hue wheel from this paper And so I created fat colorbars using the three palettes I used in the last post, saved them as images, and run the monitor with them. Here below are the results for Matlab jet, Industry Spectrum, and cubeYF. Looking at these palettes in terms of harmony I would say that jet is not very harmonic (too large a portion of the hue circle; the T template, which is the largest, spans 180 degrees), and that the spectrum is terrible.
CubeYF is also exceeding a bit 180 degrees, but looks very close to a T template rotated by 180 degrees (rotations are allowed). So perhaps I could trim it a bit? But to me it looks a lot nicer and gives me a vibe of really good mood, and reminds me of one of those beautiful central american headdresses, like Moctezuma’s crown.
Notes
[1] Created with data from the Global Land One-km Base Elevation Project at the National Geophysical Data Center.
[2] Looking at the intensity of the colorbars may help in the assessment: the third and fourth colorbars are very similar and both look perceptually linear, whereas the first and second do not.
[3] Quoted from Richard’s blog post: “… in the middle is a circular histogram of the colours (spectral shades) in the image, and gives an idea of how much of each colour there is. Up the left is a histogram of image brightness (lightness of colour), and up the right is a histogram of colour saturation (vibrancy)”.
[4] Quoted from the paper’s abstract: “Harmonic colors are sets of colors that are aesthetically pleasing in terms of human visual perception. If you are interested in this idea there is a set of slides and a video on the author’s website




Pingback: The rainbow is dead…long live the rainbow! – series outline | MyCarta·
Is it possible to cast CubeYF to RGB for use in software that can only handle palettes defined with by the RGB model?
Hi Martin
The palettes are already converted back to RGB space an ready for use.
Let me know how it work for you.
Matteo
That is correct
Thanks for pointing that out Martin, I added a note in the post
A fellow member of the Matlab Users and Integrators group on LinkedIn asked:”..are perfectly balanced (color length equal across spectrum) possible or ideal?”
To which I replied:”If I understand your question correctly, you want to know if it is possible to make color palettes where perceptual distance between samples does varies regularly – in other words where Euclidean distance between data values correspond to Euclidean distance between hues. If that’s the case, the quick answer is yes. If you accept that CIELab color space is a good approximation of human perception, then you all you need is a color palette with linear Lightness like the one in this post:
http://mycarta.wordpress.com/2012/12/06/the-rainbow-is-deadlong-live-the-rainbow-part-5-cie-lab-linear-l-rainbow/
To me CIELab is a good starting point. By using it, we certainly get in ballpark. There are however more recent color spaces that are considered even better approximations of human vision.”
See for example the discussion in chapter 1.3 of Computational Colour Science using MATLAB (Wiley), by Stephen Westland and Caterina Ripamonti
http://books.google.ca/books?id=sFNTmU-H9QgC&printsec=frontcover&dq=color+science+matlab+westland&hl=en&sa=X&ei=iTk6UYyaAcSE4ATG-IGwCw&ved=0CDoQ6AEwAA
Pingback: Color palettes for seismic structure maps and attributes | MyCarta·