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

博文

【MATLAB】如何画水平errorbar

已有 7578 次阅读 2018-3-10 13:57 |个人分类:Matlab|系统分类:科研笔记| matlab, errorbar, 水平, 图像可视化

垂直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

herrorbar.m

调用方法:

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)




https://blog.sciencenet.cn/blog-2824237-1103192.html

上一篇:【MATLAB】如何统一设置clabel标注数字的小数位
下一篇:【MATLAB】调整fill填充颜色的透明度
收藏 IP: 219.146.245.*| 热度|

0

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

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

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

GMT+8, 2024-5-11 16:04

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部