contour with gray colormap using external tools

Besides the solution presented above it is possible to use the tools freezeColors and COLORMAP and COLORBAR utilities to change the colormap in a single figure.

% clear command window, figures and all variables
clc; clf; clear all; 
 
%% Common variables
 
FontSize = 12;
FontName = 'MyriadPro-Regular'; % or choose any other font
 
doExportPlot = true;
 
%% Plot variables
SaveDir = '';
 
TITLE = '';
    xLabelText = 'x-values';
    yLabelText = 'y-values';
    zLabelText = 'function values';
 
 
%%
SaveDir = '';
BaseDir = '';
%% Create Data
[x y data] = peaks(1000);
data = data - min(min(<span class="hiddenGrammarError" pre="">data));
data</span> = data / max(max(data));
 
%% start plot
 
% figure dimensions in cm. I choose 1.5 or 2 times 
% the target size typically. If figure is display in
% document much smaller increase the fontsize.
 
figure_width = 14;  
figure_height = 10;
 
% --- setup plot windows
figuresVisible = 'on'; % 'off' for non displayed plots (will still be exported)
hfig = figure(1); clf;
    set(hfig,'Visible', figuresVisible)
 
    set(hfig, 'units', 'centimeters', 'pos', [5 5 figure_width figure_height])   
    set(hfig, 'PaperPositionMode', 'auto');    
    set(hfig, 'Renderer','zbuffer'); 
    set(hfig, 'Color', [1 1 1]); % Sets figure background
    set(gca, 'Color', [1 1 1]); % Sets axes background
 
% --- dimensions and position of plot 
hsp = subplot(1,1,1, 'Parent', hfig);
set(hsp,'Position',[0.12 0.15 0.80 0.8]);
 
colorDepth = 1000;