当前位置: 首页 > 工具软件 > matlab-on-aws > 使用案例 >

matlab中线条4px,matlab 地图散点图

齐成双
2023-12-01

clc;clear all;close all;

aa=load('data.txt');

lat=aa(:,2);

lon=aa(:,1);

height=aa(:,3);

[X1 Y1] =

meshgrid(115.4:0.03:117.4,39.5:0.03:41);

[X,Y,Z] =

griddata(lon,lat,height,X1,Y1);

figure(1);

ma=shaperead('bou1_4p.shp');%

读取国界shp文件,a为结构体。输入whos a 可查看结构体

mb=shaperead('bou2_4p.shp');%

省界

bou1_4lx=[ma(:).X];%

提取经度

bou1_4ly= [ma(:).Y];%

提取纬度

m_proj('Lambert Conformal

Conic','lon',[115.4,117.4],'lat',[39.5,41]);% 投影

m_plot(bou1_4lx,bou1_4ly);%绘图,查看边界是否正确,注意其实国界在省界之内,不必提取国界也可以由省界表示出国界来。

bou1_4px=[mb(:).X];%同上

bou1_4py=[mb(:).Y];%同上

m_plot(bou1_4px,bou1_4py)%同上

provence=[bou1_4px',bou1_4py'];

save

prov.datprovence–ascii;

hold on;

[cs,h]=m_contour(X,Y,Z,'linewidth',2);

clabel(cs,h,'fontsize',8);

m_grid('linest','none','linewidth',2,'tickdir','out','FontSize',15);

%控制坐标轴上的字体大小

xlabel('Longitude','fontsize', 15);

%控制坐标轴名称的字体大小

ylabel('Latitude','fontsize', 15);

%控制坐标轴名称的字体大小

nc = 16;

offset = 1;

c = height -

min(height);

c =

round((nc-1-2*offset)*c/max(c)+1+offset);

m_scatter(lon,lat,30, height,

'filled');

colorbar

title('The distribution of the AWS

stations','fontsize', 14);

hold on;

print(1,'-dpng','./BJawsstationsmap.png');

exmaple 2

from http://blog.sina.com.cn/s/blog_574e683c0100um6t.html

close all

clear all

%fileID=fopen('30.dat');

%M = fread(fileID);

aa=load('30.dat');

lat = aa(:,2);

lon =aa(:,1);

hgt =aa(:,3)

[X1,Y1] = meshgrid(19.85:0.005:20.22,-78.38:0.005:-78.22);

figure(2)

worldmap([-78.38 -78.22], [19.85 20.22]);

%h1=axesm('MapProjection','eqdcylin','maplatlimit',[-78.38

-78.22],'maplonlimit',[19.85 20.22],'frame','on',...

%  'parallellabel','on','meridianlabel','on','flinewidth',20,'plabellocation',5,'mlabellocation',10);

%setm(h1,'fedgecolor',[.5 .6

.6],'fontname','Arial','fontsize',7)

%grid off;

scaleruler on

scatterm(lon,lat,24,hgt);

 类似资料: