Question

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)
Was it helpful?

Solution

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]);

will 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.

OTHER TIPS

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top