Code covered by the BSD License  

Highlights from
Perceptually improved colormaps

5.0

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

Perceptually improved colormaps

by

 

08 Oct 2010 (Updated )

5 perceptual colormaps with rainbow-like colors and 1 with heat colors

| Watch this File

File Information
Description

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

Example: 128-color rainbow with cubic-law luminance (default)
       % load mandrill;
       % imagesc(X);
       % colormap(pmkmp(128));
       % colorbar;

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 the help) in that they introduce artefacts that mislead the viewer. "The rainbow color map appears as if it is 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 efforts to create more perceptually balanced color maps. Please see output arguments section for descriptions.

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

Please visit my blog to read about the background research:
http://mycarta.wordpress.com/2012/05/29/the-rainbow-is-dead-long-live-the-rainbow-series-outline/

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

Acknowledgements

Light Bartlein Color Maps, Cold Colormap, Colorspace Transformations, Spectral And Xyz Color Functions, Cline, Lab Color Scale, Shaded Pseudo Color, and Make Color Map inspired this file.

This file inspired Colormapline Color Changing 2 D Or 3 D Line.

MATLAB release MATLAB 7.4 (R2007a)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (12)
27 Mar 2014 Patrick  
23 Oct 2013 Marius

Very nice idea, never thought about these color perception issues.

There is a small bug in pmkmp.m with my version of MATLAB (8.1.0.604 (R2013a)). When using the edge colormap and n values around 100 (e.g. 128 or 64) I get

>> colormap(pmkmp(128,'edge'))
Error using colormap (line 99)
Colormap must have values in [0,1].

I think this is due to interp1 returning negative values under these circumstances.

29 Aug 2013 Matteo Niccoli

Sebastian, John (and Petros, long overdue) thanks for the positive rating and feedback.

Joshua, thanks for the rating and comments, and also for spotting the error in the code. I just moved back to Canada after a year in Norway and my computer (with Matlab) is on a slow boat, I will re-submit with the corrected code asap.

13 Aug 2013 Sebastian Hölz

Nice,

I just had a long discussion with a colleague a few days ago on "big" anomalies in his plot, which were mainly due to the perception of the chosen colormap (jet).

I really like the "Edge" and "LinearL" colormaps and will must likely start to use them in the future.

10 Aug 2013 John D'Errico

Nice job.

09 Aug 2013 Joshua

Really cool function, never thought about the perceived visual gradients in data due to luminosity mismatch. There was one error in the code where the 'linearl' and 'linlhot' were missing their switch statements. Here is the corrected switch statement on line 295 to access those last two color profiles:

switch lower(scheme)
case 'isol'
baseMap = IsoL;
case 'cubicl'
baseMap = CubicL;
case 'edge'
baseMap = Edge;
case 'cubicyf'
baseMap = CubicYF;
case 'linearl'
baseMap = LinearL
case 'linlhot'
baseMap = LinLhot

otherwise
error(['Invalid scheme ' scheme])
end

28 Feb 2013 Matteo Niccoli

Correct link:
http://mycarta.wordpress.com/2012/05/29/the-rainbow-is-dead-long-live-the-rainbow-series-outline/

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/

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.

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');

25 Mar 2011 Colin  
14 Oct 2010 Petros Mpogiatzis

indeed, perceptually better!

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

27 Feb 2013

Added a linear lightness rainbow colormap
Added a linear lightness adjusted heat colormap
Added first line to examples.m as suggested by COlin in the comments

Contact us