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 (2021). errbar (https://www.mathworks.com/matlabcentral/fileexchange/50472-errbar), MATLAB Central File Exchange. Retrieved .
Maybe it could also add log scale plot function
Great catch Ian. I've implemented the change you suggested. Thanks for the feedback.
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.')
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.
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
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!