How to create a correct barplot from table?

조회 수: 3 (최근 30일)
Szabó-Takács Beáta
Szabó-Takács Beáta 2020년 9월 10일
답변: Cris LaPierre 2020년 9월 10일
Dear All,
I have a table T where the first column values are: '< 20°', '21°- 30°', '31° - 40°', '41° - 50°', '51° - 60°', '> 61°'. I attached a figure about the T table. I created a bar plot by:
bar(categorical(T{1:6,1}),T{1:6,2:10});
legend({"0","1","2","3","4","5","6","7","8"});
I attached the resulted figure. The first x-axes value is '21°- 30°' and the value of '< 20°' is at the end. I do not understand why. Could someone write a suggestion to fix this issue?
  댓글 수: 1
Ameer Hamza
Ameer Hamza 2020년 9월 10일
Can you attach the table T as a mat file?

댓글을 달려면 로그인하십시오.

채택된 답변

Cris LaPierre
Cris LaPierre 2020년 9월 10일
You probably need to impose an order on your categorical data. Otherwise, it is automatically arranged in alpha-numeric order. Use the reordercats function for this.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Line Plots에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by