フィルターのクリア

how to add numbers above the tips of a bar chart

5 ビュー (過去 30 日間)
Tariq Hammoudeh
Tariq Hammoudeh 2022 年 1 月 9 日
コメント済み: Rik 2022 年 1 月 10 日
I have an array
b=[ 1 2 3]
then i use bar(b)
now how can i write the value of each bar (so the elements of the array) over each bar.

採用された回答

Rik
Rik 2022 年 1 月 9 日
b=[1 2 3];
labels=arrayfun(@num2str,b,'Uni',0);
bar(b)
text(1:numel(b),b+0.1,labels)
  4 件のコメント
Tariq Hammoudeh
Tariq Hammoudeh 2022 年 1 月 9 日
@Walter Roberson Thank you for that.
Just one more question, im using:
xticks(1:3);
xticklabels({'one', 'two' , 'three'})
How can i increase the font size, because
FontSize
doesnt work in xticklabels
Rik
Rik 2022 年 1 月 10 日
The documentation of the axes properties states the following:
The font size affects the title, axis labels, and tick labels.
So to adjust the tick label font you will have to change the axes font size.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLine Plots についてさらに検索

タグ

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by