Y=[0.9 0.83 0.700;1.586 1.604 1.989];
X = 1:size(Y,2);
STD_low=[0.0569,0.05499,0.0438;0.27 0.058 0.164];
STD_high=STD_low;
figure
b=bar(X,Y);
xtips1 = b(1).XEndPoints;
ytips1 = b(1).YEndPoints;
for k1 = 1:size(Y,1)
ctr(k1,:) = bsxfun(@plus, b(k1).XData, b(k1).XOffset');
ydt(k1,:) = b(k1).YData;
end
hold on
errorbar(ctr, ydt, STD_low, '|g')
labels1 = string(b(1).YData);
text(xtips1,ytips1,labels1,'HorizontalAlignment','center',...
'VerticalAlignment','bottom')
xtips2 = b(2).XEndPoints;
ytips2 = b(2).YEndPoints;
labels2 = string(b(2).YData);
text(xtips2,ytips2,labels2,'HorizontalAlignment','center',...
'VerticalAlignment','bottom')
xticklabels(X)
2 Comments
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/666278-add-standard-deviation-value-and-text-on-bars#comment_1166518
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/666278-add-standard-deviation-value-and-text-on-bars#comment_1166518
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/666278-add-standard-deviation-value-and-text-on-bars#comment_1166618
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/666278-add-standard-deviation-value-and-text-on-bars#comment_1166618
Sign in to comment.