MATLAB画图问题

Matlab 画图问题

本人真小白,不太懂MATLAB,还请大佬多多指教
clear % 清除所有工作区的内存
close all % 关闭所有打开的figure

%% 读取U和V
a = ncinfo(‘E:\xiaochuang\shujv\U\U_summer_06.nc’) % 看一看这个nv文件里面,到底都有什么内容
a.Variables.Name % 输出nc文件的所有变量的名字,其中里面有lon lat tmp time 4个变量

longitude = ncread(‘E:\xiaochuang\shujv\U\U_summer_06.nc’,‘longitude’);
latitude = ncread(‘E:\xiaochuang\shujv\U\U_summer_06.nc’,‘latitude’);
u = ncread(‘E:\xiaochuang\shujv\U\U_summer_06.nc’,‘u’);
level = ncread(‘E:\xiaochuang\shujv\U\U_summer_06.nc’,‘level’);
level = sort(level);
index = find(level == 200 | level == 300 | level == 500);
u = u(:,:,index,:);
u = mean(u,4);

v = ncread(‘E:\xiaochuang\shujv\V\V_summer_06.nc’,‘v’);
level = ncread(‘E:\xiaochuang\shujv\V\V_summer_06.nc’,‘level’);
level = sort(level);
index = find(level == 200 | level == 300 | level == 500);
v = v(:,:,index,:);
v = mean(v,4);

u1 = sqrt(v.^2 + u.^2);

%% 读取blh
a = ncinfo(‘E:\xiaochuang\shujv\BLH\blh_summer_06.nc’) % 看一看这个nv文件里面,到底都有什么内容
a.Variables.Name % 输出nc文件的所有变量的名字

% 提取所有变量
blh = ncread(‘E:\xiaochuang\shujv\BLH\blh_summer_06.nc’,‘blh’);

%得到map的XY数据
map_path = shaperead(‘d:\Users\Administrator\Desktop\中国行政区.shp’); % set path of .shp files
map_X= [map_path(😃.X]; % read x of the contour of province
map_Y = [map_path(😃.Y]; % read y of the contour of province

%% 画图
[Lon,Lat] = meshgrid(longitude,latitude);
figure
for i = 1 : length(index)

subplot(1,3,i)
hold on
imagesc(longitude,latitude,mean(blh,3))
contour(Lon,Lat,u1(:,:,i)','ShowText','on')
colormap(jet(500))
h = colorbar;
h.Location = 'southoutside';
xlabel('Lon (°)')
ylabel('Lat (°)')
title(['level = ' num2str(level(i)) 'hpa'])

 m_proj('Miller','lon',[60, 110],'lat',[20,50])% set projection, and range
m_plot(map_X,map_Y,'linewidth',2,'color','r') % draw political line
m_grid('gridcolor','none') % draw grid

end

这个是代码,本来想画出像是最右边的图加上边界线,但是画出来了左边两幅图,不知道如何解决这个问题,还请大佬带带我
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值