matlab_地图
%% 世界地图 figure; ax = worldmap('World'); % setm(ax, 'Origin', [0 180 0]) land = shaperead('landareas', 'UseGeoCoords', true); geoshow(ax, land, 'FaceColor', [0.5 0.7 0.5]) lakes = shaperead('worldlakes', 'UseGeoCoords', true); geoshow(lakes, 'FaceColor', 'blue') rivers = shaperead('worldrivers', 'UseGeoCoords', true); geoshow(rivers, 'Color', 'blue') cities = shaperead('worldcities', 'UseGeoCoords', true); geoshow(cities, 'Marker', '.', 'Color', 'red') title('世界地图','FontSize',14,'FontWeight','Bold'); %% 中国地图 figure; worldmap([15 55],[70 140])%纬度经度范围显示 %显示矢量数据 sh1 = shaperead('中国行政区', 'UseGeoCoords', true); geoshow(sh1, 'FaceColor', [0.5 1.0 0.5]); setm(gca,'MLineLocation',5)%设置经度间隔为5 setm(gca,'PLineLocation',10)%设置经度间隔为10 setm(gca,'MLabelLocation',5)%设置经度标签为每隔5度 setm(gca,'PLabelLocation',10)%设置纬度标签为每隔10度 title('中国地图','FontSize',14,'FontWeight','Bold'); %% 美国地图 figure; ax = worldmap('USA'); load coast geoshow(ax, lat, long,... '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) title('美国地图','FontSize',14,'FontWeight','Bold');
其中画中国地图时,要下载文件chinadata,添加到matlab文件路径。链接: https://pan.baidu.com/s/1irWbAfejcDo2sGuDhWg1NQ 密码: krga