MATLAB: How to compare two values

datamininggraphs

I want to compare two sets of vaues and plot bar graph
apple=[56 90 23 12 34] orange=[23 45 56 90 10] these two in y axis
and in X axis
months=['jan','feb','mar','apr','may']
i need to plot these in different colours
say apple in red
and orange in green
i want to compare in month of jan,feb ,mar,apr,may,how many apples and oranges were there
please help

Best Answer

apple=[56 90 23 12 34];
orange=[23 45 56 90 10];
data = [apple' orange'];
hbar = bar(data);
set(hbar(1),'facecolor',[1 0 0]);
set(hbar(2),'facecolor',[0 1 0]);
set(gca,'xticklabel',{'jan','feb','mar','apr','may'})
Related Question