errShade(x,y,ePlus,​eMinus,lineCol,line​Width,lt)

Simple code to plot a shaded error region and a curve that goes through it.
111 Downloads
Updated 12 Oct 2015

View License

This code plots a shaded error region and a curve that goes through it on any type of 2-D plot (e.g. semilog, loglog, regular plot). Note: You must first specify the plot type by plotting a curve before calling this function. The recommended usage is to plot your curve first, then call the function which will overplot the error region and curve.
Usage:
INPUTS:
x - array of x values for line
y - array of y values for line
ePlus - upper error value above the line (i.e. maxError(x)-y(x))
eMinus - lower error value below the line (i.e. y(x)-minError(x))
lineCol - color of line (either string: 'r'-red, or RGB triplet)
lineWidth - width of line
lt - lightness (mix ratio of color with pure white) [Note: 0.2 works quite nicely with common MATLAB colors 'r','b']

OUTPUT:
cH - handle of plotted curve
eH - handle of shaded error region

Cite As

Alan Seltzer (2024). errShade(x,y,ePlus,eMinus,lineCol,lineWidth,lt) (https://www.mathworks.com/matlabcentral/fileexchange/53494-errshade-x-y-eplus-eminus-linecol-linewidth-lt), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2015b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
1.0.0.0

added new functionality to control the shading of the filled error region with a mixing ratio between the line color and white
typos in description