I was using the coord_flip functionality with geom_bar (I use bar plots a lot, I know).
When inspecting my results I was slightly confused, but then I noticed the data and the legend are not in the same order anymore.
It's a minor thing, but when presenting such plots, I'd like them to be as intuitive as possible. So I was wondering if there is a way to either mirror the coordinate system in X, or to flip the order of the legend items?
I now see that in the ggplot cheatsheet, the coord_flip actually does the transformation as I would expect (mirrored w.r.t. your output):
x=[ones(4,1);2*ones(4,1)];
y=[1:4, 1:4]';
c=x;
l=repmat({'smallest','small','big','biggest'}',2,1);
xc = arrayfun(@num2str,x,'unif',0);
clear g
g(1,1)=gramm('x',xc,'y',y,'color',c,'lightness',l);
g(1,1).geom_bar('dodge',1.5,'width',1.2);
g(1,2)=gramm('x',xc,'y',y,'color',c,'lightness',l);
g(1,2).geom_bar('dodge',1.5,'width',1.2);
g(1,2).coord_flip();
g.set_names('y','','x','');
g.set_order_options('lightness',0);
g.axe_property('YTick',[],'LineWidth',1,'YColor',[1 1 1])
figure('Position',[100 100 600 200]);
g.draw();