matlab画图——地图背景

使用Matlab加载shp地图

世界shp地图下载

画地图

要先下载m_map插件

再下载shp地图包

如部分加拿大气温检测站点图:

matlab画图——地图背景_第1张图片

%由经纬度坐标绘制点图
clc
clear all
close all
%读取excel数据
hold on
%绘制背景地图
 infoL=shapeinfo('C:\Users\Administrator\Desktop\pro\mapshp\gadm36_CAN_0.shp');
 Canada=shaperead('C:\Users\Administrator\Desktop\pro\mapshp\gadm36_CAN_0.shp');
 gadm36_CAN_0x=[Canada(:).X];
 gadm36_CAN_0y=[Canada(:).Y];
m_proj('lambert','lon',[-141 -52],'lat',[41 83]);
 m_plot(gadm36_CAN_0x,gadm36_CAN_0y,'k');
 %m_grid;
m_coast('color','k','linewidth',1);
latitude =xlsread('C:\Users\Administrator\Desktop\pro\50zhandian.xls', 'LLE', 'D2:D51');
latitude(11)=52.074167;
latitude(22)=45.883333;
latitude(31)=68.537517;
latitude(48)=48.557222;
longtitude=0.-xlsread('C:\Users\Administrator\Desktop\pro\50zhandian.xls', 'LLE', 'E2:E51');
longtitude(11)=-111.44944;
longtitude(22)=-82.566667;
longtitude(31)=-89.79639;
longtitude(48)=-81.390278;
[X,Y]=m_ll2xy(longtitude, latitude);

scatter(X, Y,30, 'filled');
set(gca,'YTickLabel',{'41°N','46°N','51°N','56°N','61°N','66°N','71°N','76°N','81°N'},'XTickLabel',{'-141°W','-132°W','-123°W','-114°W','-105°W','-96°W','-87°W','-78°W','-69°W','-60°W','-51°W'});

hold off

 

你可能感兴趣的:(Matlab)