matlab地理图形绘制

M_Map

figure('color','white','position', [200,100,1100,500]);
latlim = [-60 60]; #设置经纬度范围
lonlim = [0 360];
axesm('mercator','MapLatLimit',latlim,'MapLonLimit',lonlim, 'Frame','on','MeridianLabel','on','ParallelLabel','on')
axis off
setm(gca,'MLabelLocation',90)
setm(gca,'PLabelLocation',30)
[lat,lon]=meshgrid(-89.5:1:89.5,-179.5:1:179.5);
ts=1;  #温度,代入自己的温度数据,这里设置为常数即为均匀分布
pcolorm(lat, lon,ts )
geoshow('landareas.shp', 'FaceColor', [0.8 0.8 0.8]);
c = colorbar('location','eastoutside', 'fontsize', 16);
setm(gca, 'fontsize',16)
colormap jet

在这里插入图片描述

figure(123)
clf
ax = worldmap('World');
setm(ax, 'Origin', [0 180 0]); % 调整地图原点

% 世界地图
land = shaperead('landareas', 'UseGeoCoords', true); % 海岸线
lakes = shaperead('worldlakes', 'UseGeoCoords', true); % 湖泊
rivers = shaperead('worldrivers', 'UseGeoCoords', true); % 河流
cities = shaperead('worldcities', 'UseGeoCoords', true); % 城市
geoshow(ax, land, 'FaceColor', [0.5 0.7 0.5])
geoshow(lakes, 'FaceColor', 'blue')
geoshow(rivers, 'Color', 'blue')
geoshow(cities, 'Marker', '.', 'Color', 'black')

在这里插入图片描述
----------------------M_Map工具包绘制---------------------

m_proj('ortho','lat',48','long',-123');
m_coast('patch','r');
m_grid('linest','-','xticklabels',[],'yticklabels',[]);

在这里插入图片描述

m_proj('lambert','long',[-160 -40],'lat',[30 80]);
m_coast('patch',[1 .85 .7]);
m_elev('contourf',[500:500:6000]);
m_grid('box','fancy','tickdir','in');
colormap(flipud(copper));

在这里插入图片描述

% Note that coastline is drawn OVER the grid because of the order in which
% the two routines are called

m_proj('stereographic','lat',90,'long',30,'radius',25);
m_elev('contour',[-3500:1000:-500],'edgecolor','b');
m_grid('xtick',12,'tickdir','out','ytick',[70 80],'linest','-');
m_coast('patch',[.7 .7 .7],'edgecolor','r');

在这里插入图片描述

subplot(211);
Slongs=[-100 0;-75 25;0 45; 25 145;45 100;145 295;100 295];
Slats= [   8 80;-80  8;  8  80;-80   8; 8   80;-80   0; 0 80];
for l=1:7
    m_proj('sinusoidal','long',Slongs(l,:),'lat',Slats(l,:));
    m_grid('fontsize',6,'xticklabels',[],'xtick',[-180:30:360],...
                'ytick',[-80:20:80],'yticklabels',[],'linest','-','color',[.7 .7 .7]);
    m_coast('patch','g');
end
xlabel('Interrupted Sinusoidal Projection of World Oceans');

% In order to see all the maps we must undo the axis limits set by m_grid calls:
set(gca,'xlimmode','auto','ylimmode','auto');


subplot(212);
Slongs=[-100 43;-75 20; 20 145;43 100;145 295;100 295];
Slats= [  0  90;-90  0;-90   0; 0  90;-90   0;  0  90];
for l=1:6
    m_proj('mollweide','long',Slongs(l,:),'lat',Slats(l,:));
    m_grid('fontsize',6,'xticklabels',[],'xtick',[-180:30:360],...
                'ytick',[-80:20:80],'yticklabels',[],'linest','-','color','k')
    m_coast('patch',[.6 .6 .6]);
end
xlabel('Interrupted Mollweide Projection of World Oceans');

set(gca,'xlimmode','auto','ylimmode','auto');

在这里插入图片描述

%% Nice looking data
[lon,lat]=meshgrid([-136:2:-114],[36:2:54]);
u=sin(lat/6);
v=sin(lon/6);

m_proj('oblique','lat',[56 30],'lon',[-132 -120],'aspect',.8);
subplot(121);
m_coast('patch',[.9 .9 .9],'edgecolor','none');
m_grid('tickdir','out','yaxislocation','right',...
            'xaxislocation','top','xlabeldir','end','ticklen',.02);
hold on;
m_quiver(lon,lat,u,v);
xlabel('Simulated surface winds');
subplot(122);
m_coast('patch',[.9 .9 .9],'edgecolor','none');
m_grid('tickdir','out','yticklabels',[],...
              'xticklabels',[],'linestyle','none','ticklen',.02);
hold on;
[cs,h]=m_contour(lon,lat,sqrt(u.*u+v.*v));
clabel(cs,h,'fontsize',8);
xlabel('Simulated something else');

在这里插入图片描述

% Plot a circular orbit
lon=[-180:180];
lat=atan(tan(60*pi/180)*cos((lon-30)*pi/180))*180/pi;
m_proj('miller','lat',82);
m_coast('color',[0 .6 0]);
m_line(lon,lat,'linewi',3,'color','r');
m_grid('linestyle','none','box','fancy','tickdir','out');
m_northarrow(-150,0,40,'type',4,'linewi',.5);

在这里插入图片描述

m_proj('lambert','lon',[-10 20],'lat',[33 48]); 

[CS,CH]=m_etopo2('contourf',[-5000:500:0 250:250:3000],'edgecolor','none');
 m_grid('linestyle','none','tickdir','out','linewidth',3);

colormap([ m_colmap('blues',80); m_colmap('gland',48)]);
brighten(.5);

ax=m_contfbar(1,[.5 .8],CS,CH);
title(ax,{'Level/m',''}); % Move up by inserting a blank line

在这里插入图片描述
m_vec; % See code in m_vec.m for details
在这里插入图片描述
m_proj(‘UTM’,‘long’,[-72 -68],‘lat’,[40 44]);
m_gshhs_i(‘color’,‘k’);
m_grid(‘box’,‘fancy’,‘tickdir’,‘in’);
m_ruler(1.2,[.5 .8]);

% fake up a trackline
lons=[-71:.1:-67];
lats=60*cos((lons+115)*pi/180);
dates=datenum(1997,10,23,15,1:41,zeros(1,41));

m_track(lons,lats,dates,'ticks',0,'times',4,'dates',8,...
       'clip','off','color','r','orient','upright');

m_northarrow(-68.5,43.4,.4,'type',2);

在这里插入图片描述

m_proj('hammer','clong',170);
m_grid('xtick',[],'ytick',[],'linestyle','-');
m_coast('patch','g');
m_line(100.5,13.5,'marker','square','color','r');
m_range_ring(100.5,13.5,[1000:1000:15000],'color','b','linewi',2);
xlabel('1000km range rings from Bangkok');

在这里插入图片描述

bndry_lon=[-128.8 -128.8 -128.3 -128 -126.8 -126.6 -128.8];
    bndry_lat=[49      50.33  50.33  50   49.5   49     49];
    
    clf;
    m_proj('lambert','long',[-130 -121.5],'lat',[47 51.5],'rectbox','on');

    m_gshhs_i('color','k');              % Coastline...
    m_gshhs_i('speckle','color','k');    % with speckle added

    m_line(bndry_lon,bndry_lat,'linewi',2,'color','k');     % Area outline ...
    m_hatch(bndry_lon,bndry_lat,'single',30,5,'color','k'); % ...with hatching added.

    m_grid('linewi',2,'linest','none','tickdir','out','fontsize',12);
    title({'Speckled Boundaries','for nice B&W presentation','(best in postscript format)'});
    m_text(-128,48,{'Pacific','Ocean'},'fontsize',18);
    
    m_northarrow(-122.5,50.2,.8,'type',3,'linewi',2);    

在这里插入图片描述

m_proj('miller','lat',[-77 77]);   
    m_coast('patch',[.7 1 .7],'edgecolor','none'); 
    m_grid('box','fancy','linestyle','-','gridcolor','w','backcolor',[.2 .65 1]);
    
    cities={'Cairo','Washington','Buenos Aires'}; 
    lons=[ 30+2/60  -77-2/60   -58-22/60];
    lats=[ 31+21/60  38+53/60  -34-45/60]; 
    for k=1:3
      [range,ln,lt]=m_lldist([-123-6/60 lons(k)],[49+13/60  lats(k)],40); 
      m_line(ln,lt,'color','r','linewi',2); 
      m_text(ln(end),lt(end),sprintf('%s - %d km',cities{k},round(range)));
    end;
    title('Great Circle Routes','fontsize',14,'fontweight','bold');
    
    set(gcf,'color','w');   % Need to do this otherwise 'print' turns the lakes black
    

在这里插入图片描述

 m_proj('azimuthal equal-area','radius',156,'lat',-46,'long',-95,'rot',30);

     ax1=subplot(2,2,1,'align');
      m_coast('patch','r');
      m_grid('xticklabel',[],'yticklabel',[],'linestyle','-','ytick',[-60:30:60]);
        
     ax2=subplot(2,2,2,'align');
      m_elev('contourf',[-7000:1000:0 500:500:3000],'edgecolor','none');
      colormap(ax2,[m_colmap('blues',70);m_colmap('gland',30)]);  
      caxis(ax2,[-7000 3000]);       
      m_grid('xticklabel',[],'yticklabel',[],'linestyle','-','ytick',[-60:30:60]);

        
     ax3=subplot(2,2,3,'align');
      colormap(ax3,[m_colmap('blues',70);m_colmap('gland',30)]);  
      caxis(ax3,[-7000 3000]);       
      m_elev('image');
      m_grid('xticklabel',[],'yticklabel',[],'linestyle','-','ytick',[-60:30:60]);

        
     ax4=subplot(2,2,4,'align');
      colormap(ax4,[m_colmap('blues')]);  
      caxis(ax4,[-8000 000]);       
      m_elev('shadedrelief','gradient',.5);
      m_coast('patch',[.7 .7 .7],'edgecolor','none');
      m_grid('xticklabel',[],'yticklabel',[],'linestyle','-','ytick',[-60:30:60]);

     ha = axes('Position',[0 0 1 1],'Xlim',[0 1],'Ylim',[0  1],'Box','off',...
               'Visible','off','Units','normalized', 'clipping' , 'off');
      text(0.5, 0.98,'This projection shows all oceans connected to each other',...
               'horiz','center','fontsize',20);

在这里插入图片描述

m_proj('lambert','lat',[5 24],'long',[105 125]);

set(gcf,'color','w')   % Set background colour before m_image call

caxis([-6000 0]);
colormap(flipud([flipud(m_colmap('blues',10));m_colmap('jet',118)]));
m_etopo2('shadedrelief','gradient',3);
 
m_gshhs_i('patch',[.8 .8 .8]);
 
m_grid('box','fancy');

ax=m_contfbar(.97,[.5 .9],[-6000 0],[-6000:100:000],'edgecolor','none','endpiece','no');
xlabel(ax,'meters','color','k');

在这里插入图片描述

  • 8
    点赞
  • 43
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值