Effacer les filtres
Effacer les filtres

How can I show the value on bars

1 vue (au cours des 30 derniers jours)
Latifa Bouguessaa
Latifa Bouguessaa le 19 Déc 2022
Réponse apportée : VBBV le 19 Déc 2022
Hi, everyone
How can I show the value on bars
here is my code;
X = categorical({'roiA','roiB','roiC','roiD', 'roiE'});
Y = [44 66 23 56 54;5 6 4 5 3 ];
bar(X,Y);
legend({'Mean','Std'},'Location','northwest','Orientation','horizontal')

Réponse acceptée

VBBV
VBBV le 19 Déc 2022
X = categorical({'roiA','roiB','roiC','roiD', 'roiE'});
Y = [44 66 23 56 54;5 6 4 5 3 ];
b = bar(X,Y);
x = b(1).XEndPoints;
y = b(1).YEndPoints;
text(x,y+2,num2str([y(:)]))
x1 = b(2).XEndPoints;
y1 = b(2).YEndPoints;
text(x1,y1+2,num2str([y1(:)]))
legend({'Mean','Std'},'Location','best','Orientation','horizontal')

Plus de réponses (0)

Catégories

En savoir plus sur Structures dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by