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
这个是代码,本来想画出像是最右边的图加上边界线,但是画出来了左边两幅图,不知道如何解决这个问题,还请大佬带带我