The plotyy(x1,y1,x2,y2,fun1,fun2)
plotyy
:
%// Set these three variables as desired offset = (x(2)-x(1))/8; width = (x(2)-x(1))/4; colors = {'b','g'}; %// Do the plot plotyy(x-offset,y1,x+offset,y2, @(x,y) bar(x,y,width,colors{1}), @(x,y) bar(x,y,width,colors{2}));

If you prefer x-ticks to display only on used x values:
h = plotyy(x-offset,y1,x+offset,y2, @(x,y) bar(x,y,width,colors{1}), @(x,y) bar(x,y,width,colors{2})); set(h,'xtick',x)