What I try to achieve is having the bars ordered by a given variable per panel.
A simple example:
library(ggplot2)
library(plyr)
df <
I think that grid.arrange
is a much better tool for this than trying to shoehorn free scales into a faceting framework:
library(gridExtra)
q1 <- ggplot(subset(df,group == 1),aes(x = reorder(fac,val),y = val)) +
geom_bar() +
facet_wrap(~group) +
coord_flip()
q2 <- q1 %+% subset(df,group == 2)
grid.arrange(q1,q2,nrow = 1)