第八星系人气爱 发表于 2024-3-1 16:41:29

MATLAB绘制柱状剖面组合图


本文作者:第八星系-李智
联系邮箱:lizhi258147369@163.com

降水柱状图
clear;clc
%降水柱状图
subplot(2,1,1)%组图2行1列第1张图
x1=xlsread('温度降水.xlsx','日期','A2:A366');%读取横坐标
y1=xlsread('温度降水.xlsx','降水','A2:A366');%读取纵坐标
bar(x1,y1,1)%绘制柱状图
ylabel('mm')%y轴坐标
axis() %确定坐标框大小
text(20,8,'Test','fontname','Times New Roman','fontsize',12,'fontweight','bold')%设置标题参数
set(gca,'XTick',[ 32 60 91 121 152 182 213 244 274 305 335])
set(gca,'xticklabel',{'02-01','03-01','04-01','05-01','06-01','07-01','08-01','09-01','10-01','11-01','12-01'})%x轴刻度
%上边这俩行,第二行给第一行指定的位置添加描述
set(subplot(2,1,1),'fontname','Times New Roman','fontsize',13,'fontweight','bold','LineWidth',5)%设置图框参数

剖面图% 剖面图
subplot(2,1,2)
x    = xlsread('温度降水.xlsx','日期','A2:A366');%读取横坐标
xmax = max(x);
xmin = min(x);
y    = ;%土壤深度,即纵坐标
ymax = max(y);
ymin = min(y);
z    = xlsread('温度降水.xlsx','温度','A2:E366');%每一个(x,y)点上的值
C=z';
N = 365; % 每个维度的数据点数
=meshgrid(linspace(xmin,xmax,N),linspace(ymin,ymax,N));% 网格化x,y二维空间
Z =griddata(x,y,C,X,Y,'linear');% 采用插值法扩展数据,使用'linear'的方法
contourf(X,Y,Z,N, 'LineColor','none');%设置等高线图
colormap('jet')%设置颜色图
colorbar('fontname','Times New Roman','FontSize',15,'LineWidth',5)%设置色阶的颜色栏参数
hold on
ylabel('cm') %y轴坐标描述
set(gca,'XTick',)
set(gca,'xticklabel',{'02-01','03-01','04-01','05-01','06-01','07-01','08-01','09-01','10-01','11-01','12-01','fontname','Times New Roman','fontsize',20,'fontweight','bold'})%x轴刻度和参数
set(gca,'YTick',)
set(gca,'yticklabel',{'30', '60', '120', '160', '180'})%y轴刻度和参数
set(subplot(2,1,2),'fontname','Times New Roman','fontsize',13,'fontweight','bold','LineWidth',5)%设置图框参数
设置散点标记的颜色区间
第一步,打开figure1窗口,单击编辑绘图的箭头标呈蓝色


第二步,点击工具,勾选查看布局网格


第三步,点击剖面图边框,鼠标在框边呈十字箭头时按住鼠标左键可移动图像,呈一字箭头时按住鼠标左键可伸缩图像


第四步,点击文件,选择导出文件



第五步,点击渲染,把分辨率改为600,最后点导出

参考图


完整代码
clear;clc
%降水柱状图
subplot(2,1,1)%组图2行1列第1张图
x1=xlsread('温度降水.xlsx','日期','A2:A366');%读取横坐标
y1=xlsread('温度降水.xlsx','降水','A2:A366');%读取纵坐标
bar(x1,y1,1)%绘制柱状图
ylabel('mm')%y轴坐标
axis() %确定坐标框大小
text(20,8,'Test','fontname','Times New Roman','fontsize',12,'fontweight','bold')%设置标题参数
set(gca,'XTick',[ 32 60 91 121 152 182 213 244 274 305 335])
set(gca,'xticklabel',{'02-01','03-01','04-01','05-01','06-01','07-01','08-01','09-01','10-01','11-01','12-01'})%x轴刻度
%上边这俩行,第二行给第一行指定的位置添加描述
set(subplot(2,1,1),'fontname','Times New Roman','fontsize',13,'fontweight','bold','LineWidth',5)%设置图框参数

% 剖面图
subplot(2,1,2)
x    = xlsread('温度降水.xlsx','日期','A2:A366');%读取横坐标
xmax = max(x);
xmin = min(x);
y    = ;%土壤深度,即纵坐标
ymax = max(y);
ymin = min(y);
z    = xlsread('温度降水.xlsx','温度','A2:E366');%每一个(x,y)点上的值
C=z';
N = 365; % 每个维度的数据点数
=meshgrid(linspace(xmin,xmax,N),linspace(ymin,ymax,N));% 网格化x,y二维空间
Z =griddata(x,y,C,X,Y,'linear');% 采用插值法扩展数据,使用'linear'的方法
contourf(X,Y,Z,N, 'LineColor','none');%设置等高线图
colormap('jet')%设置颜色图
colorbar('fontname','Times New Roman','FontSize',15,'LineWidth',5)%设置色阶的颜色栏参数
hold on
ylabel('cm') %y轴坐标描述
set(gca,'XTick',)
set(gca,'xticklabel',{'02-01','03-01','04-01','05-01','06-01','07-01','08-01','09-01','10-01','11-01','12-01','fontname','Times New Roman','fontsize',20,'fontweight','bold'})%x轴刻度和参数
set(gca,'YTick',)
set(gca,'yticklabel',{'30', '60', '120', '160', '180'})%y轴刻度和参数
set(subplot(2,1,2),'fontname','Times New Roman','fontsize',13,'fontweight','bold','LineWidth',5)%设置图框参数

微信搜索“第八星系人造大气理论爱好者”公众号,关注获取文章数据

FrankJScott 发表于 2024-9-23 21:41:42

New AMANSLOT88 Tips

For the person inquiring about hk sgp sdy, judi toto slot, t0gel online, judi sgp 1, judi hk online, nama judi togel, bandar judi togel online, online toto 4d, hk sdy, bandar togel dunia,I highly recommend this more about the author on AMAN88 site or bandar judi toto, toto 4d 2022, web judi togel, sgp sydney, singapore 4d slot, judi hongkong online, nama judi togel, data hk sdy sgp, sdy slot 4d, judi toto, not forgetting sites such as this best AMANSLOT88 info as well as on toto 4d, website judi togel, 4d asia, togel online 2023, judi toto, toto 4d 2022, bandar judi toto, data hk sdy sgp, 4d setiap hari apa, 4d baru, not forgetting sites such as this new AMAN88 site which is also great. Also, have a look at this her response for AMANSLOT88 forum and don't forget sgp judi, bandar judi togel online, hk sdy sgp, 4d setiap hari apa, result sdy sgp hk, sdy hk sgp, data hk sdy sgp, web judi togel, sdy sgp hk pools, singapore 4d slot, alongside all this more helpful hints about AMANSLOT88 site as well as bandar judi toto, 4d asia, judi hk online, result sdy sgp hk, judi hongkong online,enquiry for together with 4d setiap hari apa, toto e wallet, sdy slot 4d, t0gel online, hk sdy,for good measure. Check more @ New Togel Website c2cdecb
页: [1]
查看完整版本: MATLAB绘制柱状剖面组合图