File Exchange

image thumbnail


version (33.9 KB) by Chad Greene
Easily create vertical or horizontal error bars.


Updated 17 Jul 2015

View Version History

View License

A more adaptable, less visually-cluttered version of Matlab's built-in errorbar function. Works with vertical or horizontal error bars. See the documentation page (little light bulb icon) for examples.

Cite As

Chad Greene (2021). errbar (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (9)

Rapaka Sri Datta

Julian Matthews


Maybe it could also add log scale plot function

Martin Lindén

Chad Greene

Great catch Ian. I've implemented the change you suggested. Thanks for the feedback.

Ian Craig

Great submission!

Your input validation at the start throws an error if a vector has NaN values. The built-in errorbar function just skips those. I suggest changing tests in lines 139 and 140 to something like:

assert(all(L(~isnan(L))>=0),'Errorbar lower limits must be greater than or equal to zero.')

Chad Greene

That's an excellent idea, David. I've updated the function with the change you suggested. I have verified that it works for Matlab pre-2014b and post-2014b. Thanks for the recommendation.


This is the best solution available for errbar plotting post 2014.

I recommend a modification to errbar code. Setting 'HandleVisibility' to 'off' in the final four plot calls will restore typical users expectations for the legend('show') command.


MATLAB Release Compatibility
Created with R2012b
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!