views:

195

answers:

3

I want a lighter version of the "cyan" color, using the function colormap('cyan'). How do you do this?

+1  A: 

Pure cyan is represented by the RGB triple [0 1 1]. To make it lighter, just increase the red component (ex: [0.5 1 1]), thus moving it closer to pure white ([1 1 1]). If you want to make a colormap that spans from pure cyan through lighter shades of cyan all the way to pure white, you can do the following:

nValues = 128;  %# The number of unique values in the colormap
map = [linspace(0,1,nValues)' ones(nValues,2)];  %'# 128-by-3 colormap

Now you can set the colormap to the one made above using the COLORMAP function:

colormap(map);

For more discussion of colors in MATLAB, check out this link.

gnovice
A: 

For me colormap('cyan') fails because cyan is undefined.

However, you can create your own colors easily. If cyan is equivalent to [0,1,1] a lighter color would be [0,1,1] + [.1,0,0] = [.1,1,1] or rather just increase the R in RGB to increase the luminosity.

James
+4  A: 

Check out the function BRIGHTEN:

X = spiral(8);
image(X)
colormap(winter), colorbar
brighten(0.6)

Another trick is to right click on the colorbar and select Interactive Colormap Shift, this allows to shift the color-to-data mapping using mouse dragging.

alt text

Amro
Neat! I didn't know about this feature. Is it new?
Jonas
To be honest, I'm not sure, but a look at the Wayback machine indicates that it was available back in 2007: http://web.archive.org/web/*/http%3A//www.mathworks.com/access/helpdesk/help/techdoc/creating_plots/f0-41699.html
Amro