www.gusucode.com > map 案例源码 matlab代码程序 > map/PlotRegionsOfRobinsonFrameAndGridUsingMapLimitsExample.m
%% Plot Regions of Robinson Frame and Grid Using Map Limits % This example shows how to plot four regions of Robinson frame and grid % using map limits. Initially, each of the plots shows the entire world, % |FLatLimit| is [-90 90], and |FLonLimit| is |[-180 180]| for each case. % The frame quadrangle can encompass smaller regions, as well, in which % case the shape is a section of a full-world outline or simply a % quadrilateral with straight or curving sides. %% % Plot four quandrangles in the Robinson Projection, symmetric about prime % meridian. % Copyright 2015 The MathWorks, Inc. figure('color','white') subplot(2,2,1); axesm('MapProjection','robinson',... 'Frame','on','Grid','on') title('Lat [-90 90], Map lons [-180 180]','FontSize',10) subplot(2,2,2); axesm('MapProjection','robinson',... 'MapLatLimit',[30 70],'MapLonLimit',[-90 90],... 'Frame','on','Grid','on') title('Lat [30 70], Lon [-90 90]','FontSize',10) subplot(2,2,3); axesm('MapProjection','robinson',... 'MapLatLimit',[-90 0],'MapLonLimit',[-180 -30],.... 'Frame','on','Grid','on') title('Lat [-90 0], Lon [-180 -30]','FontSize',10) subplot(2,2,4); axesm('MapProjection','robinson',... 'MapLatLimit',[-70 -30],'MapLonLimit',[60 150],... 'Frame','on','Grid','on') title('Lat [-70 -30], Lon [60 150]','FontSize',10) %% % Plot the same regions but with frame limits altered after projecting. % The projections are not centered on the prime meridian. Instead, the % projections are symmetric about map limits. figure('color','white') h11 = subplot(2,2,1); axesm('MapProjection','robinson',... 'Frame','on','Grid','on') title('Lat [-90 90], Lon [-180 180]') h12 = subplot(2,2,2); axesm('MapProjection','robinson',... 'Frame','on','Grid','on') setm(h12,'FLatLimit',[30 70],'FLonLimit',[-90 90]) title('Lat [30 70], Lon [-90 90]') h21 = subplot(2,2,3); axesm('MapProjection','robinson',... 'Frame','on','Grid','on') setm(h21,'FLatLimit',[-90 0],'FLonLimit',[-180 -30]) title('Lat [-90 0], Lon [-180 -30]') h22 = subplot(2,2,4); axesm('MapProjection','robinson',... 'Frame','on','Grid','on') setm(h22,'FLatLimit',[-70 -30],'FLonLimit',[60 150]) title('Lat [-70 -30], Lon [60 150]') %% % To create a symmetric frame in the lower right subplot, reset the map % limits instead of the frame limits, but be sure to reset the origin. setm(h22,'MapLonLimit',[60 150],'Origin',[]) %% % Alter the properties of the frame, which is actually a patch with face % color set to |'none'| . Set the face color to |'cyan'| . setm(gca,'FFaceColor','cyan')