MATLAB: What would the bar graph coding be

bar charMATLAB

Histo1 is a 6 column data. When click on bar graph (the image attached is displayed). How can I code it to also include text for each group of bars?

Best Answer

I am not certain what you want, so here are two possibilities:
D = load('histo1.mat');
histo1 = D.histo1;
figure(1)
bar(histo1);
set(gca, 'XTickLabel', {'Group 1', 'Group 2', 'Group 3', 'Group 4', 'Group 5', 'Group 6'})
figure(2)
bar(histo1);
legend('Group 1', 'Group 2', 'Group 3', 'Group 4', 'Group 5', 'Group 6')
Be sure to look at both figures! The code in each labels the ‘group’ data differently.