Error-bar plot for R2014a

I'm trying to plot errors bars for a bar chart, i'm going wrong somewhere.
y = [212206000000 229040000000 39312320000; 119783500000 169247500000 128418300000 ; 211838000000 706581300000 85349300000]; hBar = bar(y) set(gca,'XTickLabel', {'300 ','350 ','400 '}) legend('C','S','T', 'Location','N') grid on ylabel('N/m^{2}') xlabel ('\mum') colormap summer ctr1 = bsxfun(@plus, hBar(1).XData, [hBar(1).XOffset]'); % Centres Of Bar Groups ctr2 = bsxfun(@plus, hBar(1).XData, [hBar(2).XOffset]'); ctr3 = bsxfun(@plus, hBar(1).XData, [hBar(3).XOffset]'); ydt1 = hBar(1).YData; % Y-Data Of Bar Groups ydt2 = hBar(2).YData; ydt3 = hBar(3).YData; hold on for ydt1 = 1:4 hb = get(get(hBar(ydt1),'TEST'), 'XData'); midbar = mean(hb); errorbar(midbar, ydt(:,ydt1), y*0.1(:,ydt1), '.') % plotting errors end hold off

2 Comments

You first wanted to do it in R2014b, and I gave you code that works in HG2 in my Answer to your previous Question.
Note: see Error bars on group bar chart for the R2014b (HG2) version of my code.

Sign in to comment.

Answers (0)

Asked:

on 9 Apr 2015

Commented:

on 9 Apr 2015

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!