I would like to plot an horizontal histogram with on the y axis the name of the substances and in the x axis the numbers .
Data=[0 664 320 316 664 664 664 664 320 320 664 664 664 664 664 240 664 229 664 664]
Substances=[a b c d e f g h i l m n o p q r s t u v ]

 採用された回答

Wan Ji
Wan Ji 2021 年 8 月 30 日
編集済み: Wan Ji 2021 年 8 月 30 日

0 投票

Try to do this
counts = [0 664 320 316 664 664 664 664 320 320 664 664 664 664 664 240 664 229 664 664];
Substances = 'abcdefghilmnopqrstuv'; %
Categories = categorical(num2cell(Substances));
histogram('Categories',Categories,'BinCounts',counts)
Then the plotted result

2 件のコメント

Chiara Scarpellini
Chiara Scarpellini 2021 年 8 月 30 日
Thanks but what if I want it horizontal, with the bars starting from the y-axis and the data on the x-axis
Wan Ji
Wan Ji 2021 年 8 月 30 日
histogram('Categories',Categories,'BinCounts',counts, 'Orientation','horizontal')

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

その他の回答 (0 件)

カテゴリ

タグ

質問済み:

2021 年 8 月 30 日

コメント済み:

2021 年 8 月 30 日

Community Treasure Hunt

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

Start Hunting!

Translated by