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.
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.
Updated to allow NaN inputs. Thanks for this suggestion, Ian Craig!
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
Create scripts with code, output, and formatted text in a single executable document.