Display value in plot "Groups Bars"
显示 更早的评论
Hi
In the following code:
How can I show each bar its value
clc, clear
y = [2 2 3; 2 5 6; 2 8 9; 2 11 12];
bar(y)
for i=1:1:length(y)
text(i:i,y(i)',num2str(y(i)' ,'%0.2f')),'HorizontalAlignment','center','VerticalAlignment','bottom';
box off ;
end
I will note that I have the 2019 version that does not support the above solution
TNX :)
xtips1 = b(1).XEndPoints;
ytips1 = b(1).YEndPoints;
labels1 = string(b(1).YData);
text(xtips1,ytips1,labels1,'HorizontalAlignment','center',...
'VerticalAlignment','bottom')
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Bar Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

