MATLAB: How to do plot in uniform colorization

MATLABuniform colorization in plot

Right now, I try to plot multiple 3D plot to show how variable A depends on B and C. I want to plot in different scale, but find the colorization is not in uniform in my figures? is there line of code that I can add that maintain like a value 5 color in red in all figures? Thank you

Best Answer

Hi,
this is controlled by the CLim property of the axes. So does this example help?
h1 = subplot(1,2,1);
[X,Y,Z]=peaks;
surf(X,Y,2*Z)
colorbar
% store the color limits
cl = get(h1, 'clim');
% do the second plot
h2 = subplot(1,2,2);
surf(X,Y,Z)
colorbar
% and adjust the CLim to the cl from above:
set(h2, 'clim', cl);
Titus