Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Custom Colormap

Subject: Custom Colormap

From: May

Date: 23 Jun, 2010 15:37:05

Message: 1 of 4

I was wondering how you can make a custom colormap.

I want a colormap that is a gradient of various green shades and a colormap that is a gradient of various red shades.

Any help is appreciated, thank you.

Subject: Custom Colormap

From: Walter Roberson

Date: 23 Jun, 2010 15:49:42

Message: 2 of 4

May wrote:
> I was wondering how you can make a custom colormap.
>
> I want a colormap that is a gradient of various green shades and a
> colormap that is a gradient of various red shades.

A colormap is just a double precision array of colors, N x 3 (RGB), each
  component in the range 0 to 1.0 . Fill in the array any way you want.

For example for one with 72 green entries:

M = 72;
G = fliplr(linspace(0,1,M)) .';
myGmap = horzcat(zeros(size(G)), G, zeros(size(G)));

Subject: Custom Colormap

From: Steven Lord

Date: 23 Jun, 2010 16:39:30

Message: 3 of 4


"Walter Roberson" <roberson@hushmail.com> wrote in message
news:r2qUn.111151$304.28291@newsfe12.iad...
> May wrote:
>> I was wondering how you can make a custom colormap.
>>
>> I want a colormap that is a gradient of various green shades and a
>> colormap that is a gradient of various red shades.
>
> A colormap is just a double precision array of colors, N x 3 (RGB), each
> component in the range 0 to 1.0 . Fill in the array any way you want.
>
> For example for one with 72 green entries:
>
> M = 72;
> G = fliplr(linspace(0,1,M)) .';
> myGmap = horzcat(zeros(size(G)), G, zeros(size(G)));

To extend what Walter said, this GUI may be of interest to you:

http://www.mathworks.com/access/helpdesk/help/techdoc/ref/colormapeditor.html

--
Steve Lord
slord@mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Subject: Custom Colormap

From: Doug Hull

Date: 23 Jun, 2010 18:59:05

Message: 4 of 4

http://www.mathworks.com/matlabcentral/fileexchange/17552-makecolormap

This makes good colormaps also.

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us