Perceptual rainbow palette – the goodies

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.

South_America_maps_CubeYF_rainbow

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.

hpc_terrain

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.

jet-clrmp-mood

Jet mood

Spectrum-industry-clrmp-mood

Spectrum mood

cubeYF-clrmp-mood

cubeYF mood

 

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

Related posts

14 responses to “Perceptual rainbow palette – the goodies

  1. Pingback: The rainbow is dead…long live the rainbow! – series outline | MyCarta·

  2. Is it possible to cast CubeYF to RGB for use in software that can only handle palettes defined with by the RGB model?

  3. 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

  4. Pingback: Color palettes for seismic structure maps and attributes | MyCarta·

  5. Hi, I’m a bit confused by the RGB download of CubeYF. I’m trying to import the color ramp into ArcGIS, which takes RGB values. In the spreadsheet, is column 1 = R, column 2 = G, column 3 = B ? And for the color values in each column, they are decimal values, does this mean 0.443 = 43.3 when entering into RGB? RGB is typically whole number numbers 111,123,233. Really love the CubeYF and would love to use it (crediting you of course!)

    • Hi Tim

      Good question. I should clarify it in the post and page. You understand correctly that the three columns are column 1 = R, column 2 = G, column 3 = B. But the values are not in the range 0-255 as some programs require; they are in the range 0-1 as some other programs require. To get from the values in the file to the values you need, just multiply by 255 and round the values to integer.

  6. Pingback: NASA Worldview satellite image browser adopts MyCarta perceptual rainbow | MyCarta·

  7. Hi Matteo,
    thanks for your work in this interesting yet sometimes underrated area.

    I’m using your colormap to plot spectrograms of audio signals but I have the impression the results are somehow worse than what I was obtaining with the MATLAB ‘hot’ colormap. After reading your article I think they’re worse only in the way that my perception was previously tricked by the ‘hot’ colormap, but in one of your previous posts that very colormap is described as a decent one (much better than ‘jet’, for example), so I can’t understand why my perception seems to be that different :)

    That’s why I wanted to ask you a question: do you think your colormap is suitable with any kind of dataset, no matter their values?

    • Hi Giuliano

      Thanks for your comments.

      The shortest and more generic answer to your last question is no, I don’t think the perceptual colormap I shared are suitable with any kind of dataset. One example: the cube law rainbow (CubeYF) may not work well for divergent data (positive and negative values, where the zero is significant) where positive and negative amplitudes have equal importance. That is because the ramp of the cube law changes on either side of the central sample.

      In the specific case of your spectrograms, it would be difficult without looking at some examples. Would you be able to share them?

      If you aren’t, here are some thoughts: I would definitely favor a colormap with perceptual lightness profile. you are right that your perception was calibrated on the hot colormap, but I think it may be more complicated than that. The hot colormap has some artifacts but also has Lightness values varying between L=0 and L=100, providing the largest possible contrast. Conversely, the CubeYF has lightness values varying between about L=30 and L=90. The choice was a good compromise between personal taste (I like pastel hues), and the need for a good contrast range. I used figure 8 in The “Which Blair Project: A Quick Visual Method for Evaluating Perceptual Color Maps” (there is a copy of the paper here). The figure shows the effectiveness of a colormap decreases logarithmically with L contrast, so 60% is still good, but is not optimal if what you’re after IS contrast.

      If I were you I would try to use my modified heated body, or the linear L rainbow. Please do let me know how those compare, it would be really valuable feedback.

  8. Hi Matteo,
    thanks for your quick and very informative reply.
    I must admit that I hadn’t really gone deep in the construction process of your colormap and thus, I missed some details like the reduced contrast (which in my case is beneficial).

    I will produce some figures with some different colormaps (so far I’ve tried MATLAB’s ‘jet’ and ‘hot’ as well as yours and I’ll compare them with the two modified version you suggested) and share them.

    I’ll keep you posted!

    Thanks again ;)

  9. Pingback: Convert color palettes to Python Matplotlib colormaps | MyCarta·

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s