Reputation: 893
I have a bar graph in MATLAB which is plotted for 3 different variables and each of them have 9 values:
data = [first second third];
figure(1)
hb = bar(data);
set(hb(1), 'FaceColor','r')
set(hb(2), 'FaceColor','b')
set(hb(3), 'FaceColor','g')
How can I have in my plot in the x-axis instead of 1-2-3..-9 my own points 50-53,60...10 (they are not increasing linearly).
Upvotes: 0
Views: 1371
Reputation: 1300
Try this:
%data = [first second third];
data=rand(9,3)
figure(1)
hb = bar(data);
set(hb(1), 'FaceColor','r')
set(hb(2), 'FaceColor','b')
set(hb(3), 'FaceColor','g')
set(gca,'xticklabel', {'A','B','C','D','E','F','G','H','I'})
set(gca,'xticklabel', xtk_label)
could change your labels into whatever you want. See more details in Set graphics object properties.
Upvotes: 2