MATLAB: How to use two different color schemes in one bar chart

barcolormap

I want to put different color schemes to represent X and Y in the bar chart. I am trying to do it with colormap but unable to do it. I am getting something like this
But I want something as put one figure on the top of second.
X = [15,12,11
18,17,13
19,18,16
15,15,15
14,13,12];
Y = [5,2,1
8,7,3
9,8,6
5,5,5
4,3,2];
figure
wi=1;
bar(Y, wi);
colormap(cool)
hold on
bar(X, wi/4);
colormap(summer)
legend('One','Two', 'Three');

Best Answer

figure
wi=1;
ax1 = subplot(2,1,1);
bar(Y, wi);
colormap(ax1,cool)
legend('One','Two', 'Three');
ax2 = subplot(2,1,2)
bar(X, wi/4);
colormap(ax2,summer)
legend('One','Two', 'Three');
Related Question