How can I change bar graph x-axis?
Show older comments
Hello, I want to order my bar graph (left hand side) in descending order but didn't succeed in ordering x-axis labels (right hand side). Values in x-axis are feature indices. How can I fix it? Thanks for the help.
[a,b] = sort(Scores_Avg,2,'descend')
bar(Scores_Avg(b))
text(1:length(a), a', num2str(a','%0.3f'),...
'HorizontalAlignment','center','VerticalAlignment','bottom');
set(gca,'XTick',b);

Accepted Answer
More Answers (1)
Henry Barth
on 11 Aug 2021
set(gca,'XtickLabels',arrayfun(@num2str,b,'UniformOutput',false));
3 Comments
MB
on 11 Aug 2021
Henry Barth
on 11 Aug 2021
what exactly is not working?
MB
on 12 Aug 2021
Categories
Find more on Annotations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
