maize2017的个人博客分享 http://blog.sciencenet.cn/u/maize2017

博文

Matlab 绘制土壤含水量Contour图

已有 1207 次阅读 2023-4-1 09:56 |个人分类:Matlab|系统分类:科研笔记


% 读取校准后土壤体积含水量数据

load('vwc_up.mat');

% 土壤体积含水量数据提取

date=datetime(vwc_up.date_up(24:2689,:)); %提取日期

water_up=vwc_up.calibration_up(24:2689,:);   % 选择一定时间段的数据



%绘图代码

date=datetime(vwc_up.date_up(24:2689,:)); %提取日期

Soil_depth=[10 20 40 100 150 200]; %土壤深度

date_1=datenum(date);

[date_C,SD]=meshgrid(date_1,Soil_depth);

contourf(date_C,SD,(water_up.*100)');  %绘制颜色图

c=flipud(jet);colormap(c);%热图颜色

set(gca,'YDir','reverse');  %设定y轴朝下

set(gca,'xaxislocation','top'); %坐标轴位置设定上部显示

datetick('x','mmm-dd')  %将坐标轴设置为日期格式

set(gca,'FontSize',10,'fontname','Times','FontWeight','bold');%设置y轴刻度标签字体

h=colorbar;

% h=colorbar('position',[0.78 0.2 0.05 0.5]); %colorbar([a b c d]),其中a,b为坐标,c为宽度,d为高度

set(h,'ylim',[0,8]);   %设置colorbar范围 

xlim([738693, 7.3880e+05]); %定义横坐标的范围

set(gca,'looseInset');

caxis([0 8]);%设置当前绘图区的颜色范围

% xlabel('GD_1_3','fontsize',12,'fontname','Times','FontWeight','bold')%设置x轴字体

ylabel('Soil depth (cm)','fontsize',12,'fontname','Times','FontWeight','bold');%设置y轴字体

title('(a1) VWC(%): GW13','fontsize',12,'fontname','Times','FontWeight','bold');

ax = gca;

ax.TitleHorizontalAlignment = 'left';%标题显示在左边

% set(gca,'TickDir','out','xticklabel',[]); %隐藏x轴刻度线标签


结果展示:

kxw.jpg




https://blog.sciencenet.cn/blog-3402238-1382582.html

上一篇:Matlab 生成指定步长的时间序列
下一篇:MATLAB cell日期列转为datetime 日期格式
收藏 IP: 211.21.23.*| 热度|

0

该博文允许注册用户评论 请点击登录 评论 (0 个评论)

数据加载中...
扫一扫,分享此博文

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-3-29 02:26

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部