4.75

4.8 | 5 ratings Rate this file 131 downloads (last 30 days) File Size: 2.17 KB File ID: #17555

Light Bartlein Color Maps

by Robert Bemis

 

15 Nov 2007 (Updated 21 Nov 2007)

Code covered by BSD License  

Generates one of four colormaps using schemes proposed in technical literature

Editor's Notes:

This file was selected as MATLAB Central Pick of the Week

Download Now | Watch this File

File Information
Description

This submission was inspired by comments from Ned Gulley in a recent Blog by Doug Hull. Ned cited an EOS article by A. Light and P.J. Bartlein who proposed some color maps designed for colorblind viewers. This function implements four of the proposed color maps using look-up tables (aka interpolation). A link to the article is included in the M-file.

MATLAB release MATLAB 5.2 (R10)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (5)
16 Nov 2007 John D'Errico

I very much like the idea of a colormap designed for color blind users. Are these maps viable for all the major color blind types? I.e., both for red-green and yellow-blue blindnesses? While I believe I know the answer, and I'm sure this is discussed in the references, a note to this effect would be useful to find in the help.

One point - Matlab uses a standard I/O paradigm. When you have a function that normally returns an argument, if no arguments are provided, it just dumps that variable to the variable ans. This is standard. However lbmap fails here. When you call lbmap with no outputs, it returns an error. So if all that you wish is to look at the resulting colormap without storing it in an array, lbmap fails. This is silly, and as I said, completely against the standard paradigm. For example:

>> lbmap(10,'redblue')
??? Error using ==> lbmap at 36
Not enough output arguments.

An alternative is to use the approach used by colormap itself. If no output is supplied, then it does not return an output at all, but merely applies the specified map to the current figure.

The code itself is quite good, simply using interp1 to expand a given map to the desired granularity.

The help is good. It includes a pair of examples. One of the variables is not defined though. While I can guess that a variable called n is the number of points in the resulting color map, an explicit comment to that effect would be helpful. Does it really cost that much more for one or two more lines?

I also like that references were listed in the code.

I found error checks, an H1 line, and nice readable code. Well done in many respects.

20 Nov 2007 John D'Errico

After a second look, I realized that the author does describe the meaning of N in the help. And, well, if the author fixes the issue to give it a consistent interface with the colormap function, then I'd certainly rate this a 5 with no hesitation. So I'll up my rating to a 5 now, and hope that he fixes it. This is a nice idea for a function, and it is well done.

15 Jan 2008 Patrick Roddy

I remember that EOS article and I'm glad someone has written some code to implement it. Got the function running no problem.

24 Jan 2008 Philip Orton  
16 Dec 2008 Jody Klymak

Nice - you can also see values for all their cmaps at:
http://geography.uoregon.edu/datagraphics/color_scales.htm

Please login to add a comment or rating.
Updates
21 Nov 2007

Relaxed nargout contstraint (from 1 to 0-1) so function can return colormap values as ANS consistent with MATLAB's other colormaps. Thanks to John D'Errico - nice catch.

Tag Activity for this File
Tag Applied By Date/Time
annotation Robert Bemis 22 Oct 2008 09:35:33
customization Robert Bemis 22 Oct 2008 09:35:33
colormap Robert Bemis 22 Oct 2008 09:35:33
visualization Robert Bemis 22 Oct 2008 09:35:33
data Robert Bemis 22 Oct 2008 09:35:33
colorblindness Robert Bemis 22 Oct 2008 09:35:33
potw Shari Freedman 17 Apr 2009 13:59:14
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com