5.0

5.0 | 2 ratings Rate this file 63 Downloads (last 30 days) File Size: 5.22 MB File ID: #28982
image thumbnail

Perceptually improved colormaps

by Matteo Niccoli

 

08 Oct 2010 (Updated 28 Mar 2012)

3 perceptual colormaps with rainbow-like colors for interval data and 1 colormap for ratio data

| Watch this File

File Information
Description

PMKMP Returns perceptually balanced colormaps with rainbow-like colors
   PMKMP(N,SCHEME) returns an Nx3 colormap.
   usage: map=pmkmp(n,scheme);

JUSTIFICATION: rainbow, or spectrum color schemes are considered a poor choice for scientific data display by many in the scientific community (see for example reference 1 and 2) in that they introduce artifacts that mislead the viewer. "The rainbow color map appears as if it’s separated into bands of almost constant hue, with sharp transitions between hues. Viewers perceive these sharp transitions as sharp transitions in the data, even when this is not the casein how regularly spaced (interval) data are displayed (quoted from reference 1). This submission is intended to share the results of my work to create more perceptually balanced, rainbow-like color maps. Please see output arguments section for descriptions.

arguments: (input)
scheme - can be one of the following strings:
     'IsoL' Lab-based isoluminant rainbow with constant luminance L*=60
                  For interval data displayed with external lighting

     'CubicYF' Lab-based rainbow scheme with cubic-law luminance(default)
                   For interval data displayed without external lighting
                   100% perceptual
     'CubicL' Lab-based rainbow scheme with cubic-law luminance
                   For interval data displayed without external lighting. As above but has red at high end (a modest deviation from 100% perceptual)
     'Edge' Diverging Black-blue-cyan-white-yellow-red-black scheme
                  For ratio data (ordered, constant scale, natural zero)

n - scalar specifying number of points in the colorbar. Maximum n=256
      If n is not specified, the size of the colormap is determined by the
      current figure. If no figure exists, MATLAB creates one.

arguments: (output)
map - colormap of the chosen scheme
- IsoL is based on work in paper 2 in the reference section. In both this paper and in several others this is indicated as the best for displaying interval data with external lighting. This is so as to allow the lighting to provide the shading to highlight the details of interest. If lighting is combined with a colormap that has its own luminance function associated - even as simple as a linear increase this will confuse the viewer. The only difference from the paper is that I changed the value of constant luminance to L*=60 to make it brighter that the authors' example.

- CubicL too is based on some of the ideas in paper 2 in the reference section but rather than using a linearly increasing L* function such as the one used by those authors, I am using a compressive or cubic law function for the increase in L*. L* ranges between 31 and 90 in the violet to yellowish portion of the colormap, then decreases to about 80 to get to the red (please refer to figure L_a_b_PlotsCubicL.png). The choice to start at 31 was a matter of taste. I like having violet instead of black at the cold end of the colormap. The latter choice was so as to have red and not white at the warm end of the colorbar, which is also a matter of personal taste. As a result, there is an inversion in the L* trend, but I believe because it is a smooth one that this is an acceptable compromise and the resulting colormap is much of an improvement over the standard rainbow or spectrum schemes, which typically have at least 3 sharp L* inversions. Please run CompareLabPlotsUsingColorspace.m or see figures: L_plot_for_CubicL_colormap.png, L_plot_for_jet_colormap.png, and L_plot_for_spectrum_colormap.png for a demonstration

- Edge is based on the Goethe Edge Colors described in the book in reference 3. In practice the colormap resembles a cold color map attached to a warm color map. But the science behind it is rigorous and the experimental work is based on is very intriguing to me: an alternative to the Newtonian spectrum. This is not perceptually balanced in a strict sense but because it does not have green it is perceptually improved in a harmonious sense (refer to paper reference 10 for a review of the concept of harmony in color visualization).

Example: 128-color rainbow with cubic-law luminance (default)
       % load mandrill;
       % imagesc(X);
       % colormap(pmkmp(128));
       % colorbar;
See files examples.m, examples1.m, and example2.m and associated figures for more examples
See files MakeLabPlotUsingColorspace.m and CompareLabPlotsUsingColorspace.m for some demonstrations

   See also: JET, HSV, GRAY, HOT, COOL, BONE, COPPER, PINK, FLAG, PRISM,
             COLORMAP, RGBPLOT
 

Extensive reference list and list of other FEX submissions of interest included in the help

Author: Matteo Niccoli
e-mail address: matteo@mycarta.ca
Release: 2.0
Release date: March 2012

Acknowledgements

The author wishes to acknowledge the following in the creation of this submission:
Light Bartlein Color Maps, Cold Colormap, Colorspace Transformations, Spectral and XYZ Color Functions, cline, Lab color scale, Shaded pseudo color, MakeColorMap

MATLAB release MATLAB 7.4 (R2007a)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (5)
14 Oct 2010 Petros Mpogiatzis

indeed, perceptually better!

25 Mar 2011 Colin  
25 Mar 2011 Colin

Really interesting discussion/solution of a topic I hadn't given enough thought to.

Colin

p.s. It might be worth adding:

set(0,'defaultfigureunits','pixels')

to the start of "examples.m". It took me a while to figure out why no figures were visible.

Alternatively you could consider using:

set(fign,'OuterPosition',[0.25 0.25 0.5 0.5],'units','normalized');

23 Apr 2011 Matteo Niccoli

Colin, thank you for your positive comments. I just got back after a trip and saw your post. I will look into improving/clarifying use of examples.m asap. I may wait a bit to implement an updated as I have some add-ons modifications I am working on.

30 May 2012 Matteo Niccoli

All research to be published here:
http://mycarta.wordpress.com/2012/05/30/the-rainbow-is-dead-long-live-the-rainbow-series-outline/

Please login to add a comment or rating.
Updates
12 Oct 2010

Added more examples in new file examples1.m
Added one of the reference papers (link disrupted)
Edited H1 line
Added justification paragraph
Modified REFERENCE AND acknowledgements in help
Removed MAC_OS hidden files

13 Oct 2010

Added more examples and demonstrations

22 Oct 2010

flipped isoL colormap so red is on the high intensity side
added one more example
minor edits and typos corrected here and there

20 Aug 2011

updated contact email

23 Mar 2012

Added a 100% perceptual version of cube law rainbow and new examples and references.

28 Mar 2012

Implemented Colin's first suggestion for examples.m

Tag Activity for this File
Tag Applied By Date/Time
colormap Matteo Niccoli 11 Oct 2010 11:39:36
data Matteo Niccoli 11 Oct 2010 11:39:36
graphics Matteo Niccoli 11 Oct 2010 11:39:36
display Matteo Niccoli 11 Oct 2010 11:39:36
customization Matteo Niccoli 11 Oct 2010 11:39:36
plot Matteo Niccoli 11 Oct 2010 11:39:36
visualization Matteo Niccoli 12 Oct 2010 14:03:34
image Matteo Niccoli 12 Oct 2010 14:03:34
color Matteo Niccoli 12 Oct 2010 14:03:34
color vision deficiency Matteo Niccoli 23 Mar 2012 17:49:18
color blindness Matteo Niccoli 23 Mar 2012 17:49:18
rainbow Matteo Niccoli 23 Mar 2012 17:49:18
spectrum Matteo Niccoli 23 Mar 2012 17:49:18

Contact us at files@mathworks.com