Re: [R] Order of factors with facets in ggplot2

2013-10-12 Thread arun
Hi, As you using library(plyr), you may try: library(ggplot2) library(plyr) df2 <- df d1 <- dlply(df2,.(f1),function(u) {                 u$f2<- reorder(u$f2,u$Avg_x)                 ggplot(mapping=aes(x=f2,y=x))+                 geom_boxplot(data=u)+stat_summary(data=u,fun.y=mean,geom="point",

Re: [R] Order of factors with facets in ggplot2

2013-10-12 Thread Ista Zahn
On Sat, Oct 12, 2013 at 12:01 PM, Lars Bishop wrote: > Hello, > > > I'd like to produce a ggplot where the order of factors within facets is > based on the average of another variable. > > > Here's a reproducible example. My problem is that the factors are ordered > similarly in both facets. I wou

[R] Order of factors with facets in ggplot2

2013-10-12 Thread Lars Bishop
Hello, I'd like to produce a ggplot where the order of factors within facets is based on the average of another variable. Here's a reproducible example. My problem is that the factors are ordered similarly in both facets. I would like to have, within each facet of `f1', boxplots for 'x' within