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 |