This is a very simple extension of MatLab's bar function to add error bars.
Updated 3 Jun 2018

View License

Released Code; update to draw graphics immediately.

Cite As

Martina Callaghan (2024). barwitherr(errors,varargin) (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2010b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Find more on Errorbars in Help Center and MATLAB Answers

Inspired: superbar

Community Treasure Hunt

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

Start Hunting!
Version Published Release Notes

Bug fix to update graphics for multiple plots on same figure. Otherwise the error bars overlay on each other instead of being bar-specific for the second group.
Added compatibility with 2014b graphics

Errors always defined in terms of upper and lower, even if symmetric.

Recent comments addressed via bug fix, appearance update and extra optional output parameter.

Only return handle if requested.

Returns handle as recommended by Eric in submission comments

Bug fix: xOrder should be specified when second argument for standard bar function is a width/property.

Now allows asymmetric errors on 1D data.

This version allows for asymmetric errors as requested.

Now accounts for the fact that if x-values are also supplied, they may not be in ascending order.