How can I change the color of bars in bar graph?

You need to plot them separately (but on the same axes):

bar(1:6,y(1:6),'k')
hold on
bar(7:numel(y),y(7:end),'b')
set(gca,'xtick',1:numel(y))

enter image description here

Leave a Comment