from : https://cn.mathworks.com/matlabcentral/answers/329953-how-to-create-bar-graph-with-categorical-data
I would like to plot a bar graph separated in categories. I tried out the example code here from Matlab Documentation:
c = categorical({'apples','oranges','pears'});
prices = [1.23 0.99 2.3];
bar(c,prices);
But I don't get the categories displayed on the "x-Axis" of the graph, instead just int's 1-3.
Answer by Gautam Ilango on 18 Mar 2017
Accepted Answer
Meanwhile I have found this workaround:
prices = [1.23 0.99 2.3];
bar(prices);
set(gca,'xticklabel',{'apples','oranges','pears'});