I have the following code, but what I want is different colors for each of the group (a bit more detail: In the first group I compare Stim1 to Stim2, Stim3, Stim4, in the second group I compare Stim2 to Stim1, Stim3, Stim4 - the same logic applies to the third group)..how can I do that? I know that I can set the color of specific bars with h(2).Facecolor, but that then applies to all groups...
Here my code so far:
model_series = [37 44 67; 37 39 64 ;44 39 64];
model_error = [15 7 7; 15 9 4; 7 9 3];
h = bar(model_series);
set(h,'BarWidth',1);
set(gca,'YGrid','on')
set(gca,'GridLineStyle','-')
set(gca,'xtick',[1 2 3 ])
set(gca,'xticklabel',{'Stimulation 1', 'Stimulation 2', 'Stimulation 3'})
set(get(gca,'YLabel'),'String','Classification Accuracy')
hold on;
numgroups = size(model_series, 1);
numbars = size(model_series, 2);
groupwidth = min(0.8, numbars/(numbars+1.5));
for i = 1:numbars
% Based on barweb.m by Bolu Ajiboye from MATLAB File Exchange
x = (1:numgroups) - groupwidth/2 + (2*i-1) * groupwidth / (2*numbars); % Aligning error bar with individual bar
errorbar(x, model_series(:,i), model_error(:,i), 'k', 'linestyle', 'none');
end