|||
垂直errorbar很容易实现,水平errorbar也经常用到,但网上很多方法都很复杂,在这里介绍一种相对简单的方法:
实例:
方法1:
figure;
err=data_std*ones(size(depth,2));
errorbar(depth,data_av,err,'-r','linewidth',2) %先画垂直方向的errorbar
hold on;
plot(depth,data_av,'k-','linewidth',2)
view(-90,90) %变换图像视角
set(gca,'xdir','reverse','ydir','reverse','linewidth',2,'fontsize',15) %调转坐标轴
xlim([0 max(depth)+100])
grid on;
上述方法仅适用于matlab2014a之前的版本,在2017a版本不适用;
方法2:
利用子程序herrorbar
调用方法:
close all;figure
hold on;
plot(U_mean,depth,'r-o','linewidth',2)
err_U=U_std;
h=herrorbar(U_mean,depth,err_U,'r-');
set(h,'linewidth',2)
Archiver|手机版|科学网 ( 京ICP备07017567号-12 )
GMT+8, 2024-10-19 23:13
Powered by ScienceNet.cn
Copyright © 2007- 中国科学报社