I have 2 vectors called R_per and A_per with some distinct values. They share a common base called the per.
I need to plot both R_per and A_per w.r.t Per in a Bar plot. The bar must be grouped as shown in this picture:
http://it.mathworks.com/help/releases/R2014b/examples/graphics/BarGraphof2DArrayExample_01.png
They must also have a common X axis scaling.
I tried using plotyy
and wrote the following code:
[hyy,hl,ho]=plotyy(per , A_per, per, R_per,'bar','bar');
xt = get(gca, 'XTick');
set(gca, 'XTick', xt, 'XTickLabel', {'200' '300' '400' '500' '700'})
set(ho,'facecolor','r','barwidth',0.2)
set(hl,'facecolor','g','barwidth',0.3)
What i get is a overlapped bar plot with uneven spacing and unclean Y axes.
I am unable to share my plot as i don't not have sufficient reputation Can someone help ?