% function errorbar_widen(he,f)
%     he = handle of the errorbar plot
%          to get this, call he = errorbar(...) when plotting
%      f = factor by which to widen the error tics
% based on http://blogs.mathworks.com/loren/2007/12/11/making-pretty-graphs/

function errorbar_widen(he,f)

hec = get(he,'children');

eX = get(hec(2),'xdata');
etic = eX(5)-eX(4);

eX(4:9:end) = eX(4:9:end) - (f-1)*etic/2;
eX(5:9:end) = eX(5:9:end) + (f-1)*etic/2;
eX(7:9:end) = eX(7:9:end) - (f-1)*etic/2;
eX(8:9:end) = eX(8:9:end) + (f-1)*etic/2;

set(hec(2),'xdata',eX);

% this is optional, it will bring the errorbar dots to the front of the plot
uistack(he, 'top')
