Code covered by the BSD License

5.0

5.0 | 8 ratings Rate this file 138 Downloads (last 30 days) File Size: 2.97 KB File ID: #26311

07 Jan 2010 (Updated 18 Jan 2010)

Creates an attractive shaded error region rather than discrete bars.

### Editor's Notes:

This file was selected as MATLAB Central Pick of the Week

File Information
Description

Creates a continuous shaded error region rather than discrete bars. Error region can either be specified explicitly or calculated on the fly based upon function handles. Handles of the plot objects are returned in a convenient structure.

Purpose
Makes a 2-d line plot with a pretty shaded error bar made
using patch. Error bar color is chosen automatically.

Inputs
x - vector of x values
y - vector of y values or a matrix of n observations by m cases
where m has length(x);
errBar - if a vector we draw symmetric errorbars. If it has a
size of [2,length(x)] then we draw asymmetric error bars
with row 1 being the upper bar and row 2 being the lower
bar. ** alternatively ** errBar can be a cellArray of
two function handles. The first defines which statistic
the line should be and the second defines the error
bar.
lineProps - [optional,'-k' by default] defines the properties of
the data line. e.g.:
'or-', or {'-or','markerfacecolor',[1,0.2,0.2]}
transparent - [optional, 0 by default] if ==1 the shaded error
bar is made transparent, which forces the renderer
to be openGl. This means that saved .eps files
won't look so good because they'll be rasters not
vectors.

Outputs
H - a structure of handles to the generated plot objects.

Examples
y=randn(30,80); x=1:size(y,2);

Overlay two transparent lines
y=randn(30,80)*10; x=(1:size(y,2))-40;
hold on
y=ones(30,1)*x; y=y+0.06*y.^2+randn(size(y))*10;

Rob Campbell - November 2009

Acknowledgements
MATLAB release MATLAB 7.8 (R2009a)
Tags for This File
Everyone's Tags
Tags I've Applied
20 Feb 2013
08 Feb 2013

what is shade error bar? i try to execute it but cannot.

27 Jan 2013
07 Aug 2012
10 Jul 2012
29 May 2012
02 Mar 2012

12 Apr 2011
07 Mar 2010