I am try to plot 16 bars, 8 of these belong to one group. I want to give this group the red color, the other 8 belong to another group which is given the blue color. I would like to arrange the bar in pairs, each pair containing one from the red group and one from the green group. I have tried the following:
bar(num1,info(1:2:end);
bar(num2, info(2:2:end);
in which info
contains 16 values I want to plot, num1=1:2:numel(info)
and num2=2:2:numel(info)
. If I do it this way, all the bars are placed adjacent to their neighbors and there are no gaps between bars. Ideally, to improve visualization, there should be space in between pairs but no space within a pair. For instance, bar1bar2 <space> bar3bar4 <space> bar5bar6<space>
...
Could someone help me with this spacing issue? Thank you so much!
num1=1:numel(info)
should benum1=1:2:numel(info)
right? otherwise, in the firstbar
command, the first and second arguments don't have the same size. – Ofri Raviv