フィルターのクリア

How to make the y axis 'counts' and x axis the variable on Histograms

71 ビュー (過去 30 日間)
Matt Egan
Matt Egan 2020 年 12 月 3 日
コメント済み: Adam Danz 2020 年 12 月 3 日
How to make the y axis 'counts' and x axis the variable on Histograms? The default is to have counts on the x axis and I want them on the y
  3 件のコメント
Matt Egan
Matt Egan 2020 年 12 月 3 日
If i replicate that with my data all that happens is I have relabled my axis to represetn the wrong thing. It doesnt change what value is represented by each axis.
Adam Danz
Adam Danz 2020 年 12 月 3 日
The statement in your question, "The default is to have counts on the x axis and I want them on the y" is incorrect. The y-axis in histograms typically represents counts, frequencies, percentages, or other statistics about the data within each bin. The x-axis represents the bins for whatever variable you're plotting (weight, height, age, etc).
> all that happens is I have relabled my axis to represent the wrong thing
You'll have to explain your goal and your interpretation of the axes more clearly.

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

回答 (2 件)

Ameer Hamza
Ameer Hamza 2020 年 12 月 3 日
編集済み: Ameer Hamza 2020 年 12 月 3 日
One option is to just rotate the view
x = rand(1000,1);
histogram(x)
view(90, 90)
Combining histcounts() with barh() is another option.

Adam Danz
Adam Danz 2020 年 12 月 3 日
編集済み: Adam Danz 2020 年 12 月 3 日
Set the orientation property to horizontal.
histogram(rand(1,1000),'Orientation','horizontal')

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by