How to create a correct barplot from table?

24 views (last 30 days)
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:
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 Comment
Ameer Hamza
Ameer Hamza on 10 Sep 2020
Can you attach the table T as a mat file?

Sign in to comment.

Accepted Answer

Cris LaPierre
Cris LaPierre on 10 Sep 2020
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.

More Answers (0)


Community Treasure Hunt

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

Start Hunting!