Dear all,
is it feasible to put the labels of the barh plot below inside the bars - and also the respective value ?
Thanks

 採用された回答

Star Strider
Star Strider 2022 年 6 月 12 日

0 投票

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 件のコメント

René Lampert
René Lampert 2022 年 6 月 18 日
Thanks
Star Strider
Star Strider 2022 年 6 月 18 日
As always, my pleasure!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by