views:

504

answers:

3

I'm trying to represent several surface plots* for which the scale differs a bit. Each surface plot is drawn in a separate subplot and/or figure.

Right now, I'm using the default color mapping, which automatically scales the whole range of the color map to my figure, i.e. the maximum of my surface is always red (in 'jet' color mode) regardless of the magnitude of this maximum.

I'd like the colormap to be consistent between the figures instead of spread between the min and max of each individual graph. That way, readers could appreciate the difference in scale of the surfaces just by looking at the color map.

Any idea on how to do this?


*Actually, in case it makes a difference, I'm plotting results of a surface fitting operation using the plot command as follows:

   [myfit, gof] = fit( ... );
   plot(fit)
+3  A: 

You should use the CAXIS function. For example, if one surface has a height from 0 to 5 and the other has a height from 0 to 10, doing the following for both plots:

caxis([0 10]);

should force them both to use the same color scale as the plot that covers the larger range. You can also call CAXIS with an axes handle as the first argument:

caxis(hAxes,[0 10]);  % Sets the color scaling for hAxes

If not specified, CAXIS adjusts the color scaling of the axes that is current.

gnovice
Thanks. I knew it had to be trivial. I just wasn't looking at the right place apparently.
Kena
Glad to help! =)
gnovice
A: 

Try the http://www.google.com/search?rlz=1C1GGLS%5FenUS291US306&sourceid=chrome&ie=UTF-8&q=matlab%2Bcolormap">colormapeditor.

CookieOfFortune
+1  A: 

I recently answered this question in video form on my blog:

http://blogs.mathworks.com/videos/2009/03/27/setting-the-colormap-to-be-consistent-across-axes/

MatlabDoug

related questions