ERRORBAR_TICK Adjust the width of errorbars
ERRORBAR_TICK(H) adjust the width of error bars with handle H. Error bars width is given as a ratio of X axis lenght (1/80).
ERRORBAR_TICK(H,W) adjust the width of error bars with handle H. The input W is given as a ratio of X axis lenght (1/W). The result is independant of the x-axis units. A ratio between 20 and 80 is usually fine.
ERRORBAR_TICK(H,W,'UNITS') adjust the width of error bars with handle H. The input W is given in the units of the curent x-axis.
For a non-experienced user, this file is a blessing to use with log graphs, however, I'm struggling with the same problem as Charlie - the changed ticks reset when trying to save the file. Do you have any workaround for this by any chance?
Very simple and works really well, however it receives four stars because I did have issues with a script breaking because of this. The issue turned out to be that the script would try to execute the command before the figure was generated, resulting in an error. Adding pause(1) before the errorbar_tick command solved this.
In order to get this file working with 2014b you can replace the original if/else statement from the "Plot error bars" portion with the following:
if strcmpi(flagtype,'errorbar') % ERRORBAR(...)
x = h.Bar.VertexData(1,:); % Retrieve bar xdata from errorbar
dp = length(x)/3; % 3 data points per error bar
m = 1; % Multiplier for addition/subtraction
for ii = 1:dp
m = -1*m; % Switch between subtraction and addition
x(dp+ii:dp:end) = x(ii)+m*w/2; % Change xdata with respect to the chosen ratio
h.Bar.VertexData(1,1:end) = x;
error('Please enter an ErrorBar object!');
The .VertexData is an undocumented property of the .Bar object (which is also undocumented), used to draw the actually 'error bars' of an ErrorBar object. The first row of VertexData is somewhat of an equivalent to the 'xdata' property currently used by this function.
Thanks for sharing your solution! It works fine as long as I one have one error bar series in a plot but I can't get it to work when I have more (as in> errorbar, hold on, errorbar). Do you have a fix for this?