【源码】MATLAB美图神器shadedErrorBar:创建连续阴影误差区域

使用举例1:基本使用方法

% Prepare data
y=randn(30,80)5;
x=(1:size(y,2))-40;
yP = sin( linspace(-2
pi,2*pi,length(x)) )*20;
y = bsxfun(@plus,y,yP)+60;

% Make the plot
clf
shadedErrorBar(x,y,{@mean,@std});

% Overlay the raw data
hold on
plot(x,y,’.’,‘color’,[0.5,0.5,0.95])

grid on

在这里插入图片描述

使用举例2:多条重叠线段绘图

% Prepare data for first line
y=ones(30,1)x;
y=y+0.06
y.^2+randn(size(y))*10;

clf
shadedErrorBar(x,y,{@mean,@std},‘lineprops’,’-b’,‘patchSaturation’,0.33)

% Overlay second line
hold on
shadedErrorBar(x,2*y+20,{@mean,@std},‘lineprops’,{’-go’,‘MarkerFaceColor’,‘g’});

%Overlay third line
y=randn(30,80)5; x=(1:size(y,2))-40;
yP = sin( linspace(-2
pi,2*pi,length(x)) )*20;
y = bsxfun(@plus,y,yP)+60;

% Make this line non-transparent
shadedErrorBar(x, y, {@mean,@std}, ‘lineprops’, ‘-r’,‘transparent’,false,‘patchSaturation’,0.075)

grid on

在这里插入图片描述

使用举例3:改变plot函数绘图特性

% Prepare data
y=randn(30,80)5;
x=(1:size(y,2));
yP = sin( linspace(-2
pi,2*pi,length(x)) )*20;
y = bsxfun(@plus,y,yP);

% Plot
clf
s = shadedErrorBar(x, y, {@mean,@std}, ‘lineprops’, ‘-r’);

% Set face and edge properties
set(s.edge,‘LineWidth’,2,‘LineStyle’,’:’)
s.mainLine.LineWidth = 5;
s.patch.FaceColor = [0.5,0.25,0.25];

% Overlay data points post-hoc
hold on
plot(s.mainLine.XData, s.mainLine.YData,‘or’,‘MarkerFaceColor’,‘w’)

grid on

set(gca,‘XTickLabel’,[],‘YTickLabel’,[])

在这里插入图片描述

MATLAB源码下载地址:

http://page2.dfpan.com/fs/0lcj82214291067ef42/

更多精彩文章请关注微信号:在这里插入图片描述

  • 2
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值