Minimum example that does not achieve it:
[X,Y,Z] = peaks;
figure;
pcolor(X,Y,Z);
shading flat;
hold all;
axes;
contour(X,Y,Z);
colormap gray; % this should
You can fix the problem by catenating two colormaps, and making sure that the values of the functions are such that they access the right part of the colormap:
cm = [jet(64);gray(64)];
figure,
pcolor(X,Y,Z)
shading flat
hold on
%# Z in the contour starts after the maximum
%# of Z in pcolor
contour(X,Y,Z-min(Z(:))+max(Z(:))+2,'LineWidth',2)
%# apply the colormap
colormap(cm)
For a more convenient solution, you may also want to have a look at this file exchange pick of the week