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.
Chad Greene (2019). errbar (https://www.mathworks.com/matlabcentral/fileexchange/50472-errbar), MATLAB Central File Exchange. Retrieved .
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! |
Inspired by: HERRORBAR, errorbarxy, Enhancement to errorbar() plot, xyerrorbar, errorbar_x, errorbarxy, ploterr, Enhanced Errorbar Function, xerrorbar - Just like errorbar, but for uncertainty in x., Plot data with error bars on both x and y axes
Inspired: errorbarxy, superbar
Create scripts with code, output, and formatted text in a single executable document.
Rapaka Sri Datta (view profile)
Julian Matthews (view profile)
yangyang (view profile)
Maybe it could also add log scale plot function
Martin Lindén (view profile)
Chad Greene (view profile)
Great catch Ian. I've implemented the change you suggested. Thanks for the feedback.
Ian Craig (view profile)
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 (view profile)
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 (view profile)
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 (view profile)