![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/724979/image.jpeg)
hot to plot horizontal Histogram??
조회 수: 30 (최근 30일)
이전 댓글 표시
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 ]
댓글 수: 0
채택된 답변
Wan Ji
2021년 8월 30일
편집: Wan Ji
2021년 8월 30일
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
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/724979/image.jpeg)
댓글 수: 2
Wan Ji
2021년 8월 30일
histogram('Categories',Categories,'BinCounts',counts, 'Orientation','horizontal')
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Histograms에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!