File Exchange

image thumbnail

errbar

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

9 Downloads

Updated 17 Jul 2015

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.

Comments and Ratings (8)

yangyang

Maybe it could also add log scale plot function

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.

David

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.

David

Updates

1.3.0.0

Updated to allow NaN inputs. Thanks for this suggestion, Ian Craig!

1.2.0.0

Removed error bar handle visibility to prevent error bars from showing up in plot legends. Thanks for this suggestion, David!

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

Discover Live Editor

Create scripts with code, output, and formatted text in a single executable document.


Learn About Live Editor

errbar/html/