nav-left cat-right
cat-right
Matthias Pospiech > Programming > matlab > pcolor and contour plot with different colormaps

pcolor and contour plot with different colormaps

combined colormap with contour labels

Additionally contour labels can be added to the contour plot. This example enhances the code previous code example.

% 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;

Unfortunately the position of the labels can not be modified with useful properties.

Seiten: 1 2 3 4 5

Einen Kommentar schreiben

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.

*

This blog is kept spam free by WP-SpamFree.