MATLAB Answers


How to use an absolute scale with colormaps

Asked by Raldi
on 9 Feb 2013

Hi everyone,

I am using image to plot a matrix of some heat data, the thing is that i want a specific color mapped in a specific value, for example if i have a maximum temperature of 45 then that will be a deep red color, and the lowest a deep blue, but if in another image i have a maximum temperature of 6 then that again will be represented with a deep red color. I dont want that, i need the scale of the colormap to remain the same no matter the data that i am plotting, is there a way to do that?

Thanks in advance.



1 Answer

Answer by Jurgen
on 9 Feb 2013
 Accepted answer

Yes, just adjust the CLim property of the axes to the desired range. e.g. caxis([0 45]) will map the colors to 0-45 range.

  1 Comment

on 9 Feb 2013

Thats it, thanks.

Join the 15-year community celebration.

Play games and win prizes!

Learn more
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

MATLAB Academy

New to MATLAB?

Learn MATLAB today!