A couple of days ago, a colleague asked me for a solution for his problem: he needed to overlap two 3D figures on MATLAB, each one with its colors. The colormap (how MATLAB maps a numeric value into a RGB color) is a property of the figure and not of the specific plot, so if you change the colormap you change the colors for all the points plotted into the figure, even if they are coming from different series.
After a little bit of googling, I’ve found the solution for this problem: freezeColors by John Iversen, a very useful script which allows to use multiple colormaps per figure. It’s a sort of
hold on for colormaps, you plot your nice 3D surface plot then you if you execute
freezeColors for all the other plots you’ll add to your figure (with
hold on or
subplot) you can choose their own colormap without changing the one you selected before. Of course, you can
unfreezeColors. [Tested with MATLAB R2008a and R2009a]