Offsetting error bars on plot and showing both positive and negative values.
Show older comments
Hi all,
I have a brief question.
Aside from manually editing the following graph in adobe illustrator or the likes, is there a way to have these error bars offset so they appear over only the orange bars. Moreover, is there a way that I can make the error bars two tailed.
Here is my code:
function GraphDataAbs( Title, Legend, YLabel, YValues_mean, YValues_std, Behaviours ) %Add back in YValues for scatter
h=figure;
xvalues= (1:numel(Behaviours));
hold on;
er = errorbar(xvalues, YValues_mean(1,:), YValues_std);
hold on;
bar(xvalues, YValues_mean, 'BarWidth', 1);
hold on;
er.Color = [0 0 0];
er.LineStyle = 'none';
set(gca,'XTick',1:numel(Behaviours),'XTickLabel',Behaviours);
ax = gca;
ax.XColor = 'k'
ax.YColor = 'k'
set(gca, 'FontName', 'Tahoma')
xtickangle(45);
ylim([0, ((max(max(YValues_mean))*1.6))]);
legend(Legend);
title(Title);
ylabel (YLabel);
filename = Title
saveas(h,filename,'jpg')
saveas(h,filename, 'epsc')

Accepted Answer
More Answers (0)
Categories
Find more on Errorbars in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!