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