Labels inside bar plot
27 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
René Lampert
il 12 Giu 2022
Commentato: Star Strider
il 18 Giu 2022
Dear all,
is it feasible to put the labels of the barh plot below inside the bars - and also the respective value ?
Thanks
0 Commenti
Risposta accettata
Star Strider
il 12 Giu 2022
Try this —
v = 52 .^ 1./(4:-1:1);
barname = {'Small','Medium','Large','Extra Large'};
figure
hbh = barh(1:4,v, 'FaceAlpha',0.5);
xlim([0 60])
text(hbh.YEndPoints/2, hbh.XEndPoints, compose('%s = %.1f',[string(barname); v].'), 'Horiz','center', 'Vert','middle')
I changed the 'FaceAlpha' (transparency) value to make the labels easier to see.
.
2 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Graphics Object Programming in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!