www.gusucode.com > map 案例源码 matlab代码程序 > map/AddColorbarToMapShowingGeoidWithNonuniformLevelsExample.m

    %% Add colorbar to map showing geoid with non-uniform levels
% 
%%
% Create a world map.

% Copyright 2015 The MathWorks, Inc.

figure('Color','white')
ax = worldmap('world');
%%
% Move the meridian labels to the bottom and reduce the number of labels.
setm(gca,'MLabelParallel',-90)
setm(gca,'MLabelLocation',90)
%%
% Load the geoid data set MAT-file.
load geoid60c
%%
% Specify levels (in meters) at which to contour the geoid.
levels = [-70 -40 -20 -10 0 10 20 40 70];
%%
% Display the geoid as a filled contour plot.
geoshow(geoid60c, geoid60cR, 'DisplayType', 'contour',...
   'LevelList',levels,'Fill','on','LineColor','black')
%%
% Load the coastline data MAT file, |coastlines.mat| .
load coastlines 
%%
% Overlay the coastlines.
geoshow(coastlat, coastlon, 'Color', 'white', 'LineWidth', 1.5)
%%
% Add a color bar to indicate the range in geoid height spanned by each
% contour interval.
cb = contourcbar('peer',ax,'Location','southoutside');
%%
% Reset the colormap and the axes color limits (CLim).
caxis([-110 90])
colormap(hsv)
cb.XLabel.String = 'Geoid Undulation in Meters';