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

pcolor and contour plot with different colormaps

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.

% use these libraries
addpath('ColorbarUtilities');
addpath('freezeColors');
 
hold on;
caxis([0 1]);
colormap(jet(colorDepth));
hplot = pcolor(x,y,data); shading flat        
 
% colorbar
hcb = colorbar('location','EastOutside', ...
    'FontSize'   , FontSize    , ...
    'FontName'   , FontName    , ...
    'Ylim'       , [0 1]       , ...
    'Box'        , 'on'        , ...
    'TickDir'    , 'in'        , ...
    'TickLength' , [.02 .02]   , ...
    'LineWidth'  , 0.6);
 
% freeze colorbar
cbfreeze;  
% apply label to colorbar 
% - here with cblabel 
hcLabel = cblabel(zLabelText);
set([hcLabel], ...
    'FontSize'   , FontSize    , ...
    'FontName'   , FontName);
 
% freeze colors (allows multiple colormaps)
freezeColors;  
 
% plot contour with different colormap
colormap(gray(colorDepth));
[C,hfigc] = contour(x, y, data,[0:0.1:1]);
set(hfigc, 'LineWidth',1.0);
 
hold off;

Seiten: 1 2 3 4 5

Einen Kommentar schreiben

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


*

Du kannst folgende HTML-Tags benutzen: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

WP-SpamFree by Pole Position Marketing