How to make the y axis 'counts' and x axis the variable on Histograms
50 次查看(过去 30 天)
显示 更早的评论
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 个评论
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
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.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Distribution Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!