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

    %% Map the United States of America Coloring State Polygons
% 
%%
% Make a map of the United States of America, coloring state polygons.
ax = worldmap('USA');
load coastlines
geoshow(ax, coastlat, coastlon,...
'DisplayType', 'polygon', 'FaceColor', [.45 .60 .30])
states = shaperead('usastatelo', 'UseGeoCoords', true);
faceColors = makesymbolspec('Polygon',...
    {'INDEX', [1 numel(states)], 'FaceColor', ...
    polcmap(numel(states))}); % NOTE - colors are random
geoshow(ax, states, 'DisplayType', 'polygon', ...
  'SymbolSpec', faceColors)