Assign (group-)labels to x-Axis in histogramm / bar chart

2 次查看(过去 30 天)
Hello,
my data is arranged as a normal vector, whereas the values represent nominal groups. Hence I want to show the group-names instead of the normal x-scale:
data = [1;1;1;2;1;1;2;4;4;4;3;4;2];
xlabel = {'A';'B';'C';'D'}
[n,xout] = hist(data,4)
bar(xout,n)
xlim([1 4])
As you might guess, I wish to label the first bar (representing all 1's) 'A' and so on.
Can somebody give me a hint? THX

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Bar Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by