Hi!
I'd like to know how can I set the values inside the bar plot, just like this:
I obtain the following bar plot using the code above but I can't place values in the correct center position.
b = bar(X,Y);
hold on
b.FaceColor = 'flat';
b.CData(1,:) = [0 0.447 0.741];
b.CData(2,:) = [0.850 0.325 0.098];
b.CData(3,:) = [0.466 0.674 0.188];
b.FaceAlpha = .7;
text(1:length(Y),Y,num2str(Y'),'vert','bottom','horiz','center');
std = [2.1 4.4 6];
er = errorbar(X,Y,std);
er.Color = [0 0 0];
er.LineStyle = 'none';
set(gca, 'ytick', []);
box off
Can you help me, please?
Thank you,
Sara
1 Comment
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/668053-how-to-put-a-numerical-value-inside-a-bar-graph#comment_1169373
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/668053-how-to-put-a-numerical-value-inside-a-bar-graph#comment_1169373
Sign in to comment.