No BSD License  

Highlights from
colorGray

4.2

4.2 | 6 ratings Rate this file 16 Downloads (last 30 days) File Size: 4.41 KB File ID: #12804
image thumbnail

colorGray

by Alexandre Tumlinson

 

26 Oct 2006 (Updated 17 Nov 2006)

Creates full spectrum, blue-green-orange-salmon, colormap that maps to linear grayscale.

| Watch this File

File Information
Description

Creates a broad range color map that looks good in color as well as when reduced to grayscale for low cost publication.

Finished colormap encodes small values with a bluish color, intermediate values in green to orange, and large values with a redish/salmon color. The greyscale is linear.

RGBcolormap=colorGray(numberOfLevels,makeDebugPlot);

Acknowledgements
This submission has inspired the following:
Bipolar Colormap
MATLAB release MATLAB 7.2 (R2006a)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (8)
07 Dec 2006 Evan Variano

Colormap that unites grayscale and full color - hooray! - Where have you been all my life?!

19 Aug 2007 Will Robertson

Great for large numbers of levels, but quite poor for just a few (e.g., if you're labelling three or four lines on a plot). In fact, the code breaks for numberOfLevels < 3. But I don't believe that's the goal of the package, so that's okay.

16 Jan 2008 Garret B

Alex is my hero!

23 Sep 2008 Manuel Guizar

The code works well but it does not use the entire gray scale range.

23 Dec 2008 Oliver Woodford

I wrote something like this (independently) myself. However, it is full greyscale (i.e. black to white) and has a wider gamut of colours. It is available as the 'contrast' colourmap of the SC package (id 16233), which also has other "colour to gray" colourmaps too: 'earth', 'pinker', 'pastel'.

21 Feb 2012 Ondrej  
21 Feb 2012 Ondrej

What about adding a next optional parameter which would set the "darkness/lightness", such that the mapping between color and grayscale wouldn't be linear.
Easy way how to do is to add a line, e.g.
RGBmap = brighten(RGBmap,0.2)
The problem is, however, that the mapping is not smooth (as can be seen on the plot, if I do e.g. colorGray(100,1)).

21 Feb 2012 Ondrej

Other suggestion is to add line:

colormap(rgb2gray(RGBmap));colorbar

in the debugplot option to see the resulting grayscale.

Please login to add a comment or rating.
Updates
17 Nov 2006

input 'numberOfLevels' is now optional. Optimized for speed and readability by vectorizing code. Added the debug plotting options.

Thx to PederAxensten for suggestions and significant code snippet.

Tag Activity for this File
Tag Applied By Date/Time
annotation Alexandre Tumlinson 22 Oct 2008 08:46:23
customization Alexandre Tumlinson 22 Oct 2008 08:46:23
colormap Alexandre Tumlinson 22 Oct 2008 08:46:23
grey Alexandre Tumlinson 22 Oct 2008 08:46:23
gray Alexandre Tumlinson 22 Oct 2008 08:46:23
greyscale Alexandre Tumlinson 22 Oct 2008 08:46:23
grayscale Alexandre Tumlinson 22 Oct 2008 08:46:23
spectrum Alexandre Tumlinson 22 Oct 2008 08:46:24
blue Alexandre Tumlinson 22 Oct 2008 08:46:24
red Alexandre Tumlinson 22 Oct 2008 08:46:24
print Alexandre Tumlinson 22 Oct 2008 08:46:24

Contact us at files@mathworks.com