It appears that ggplot reorder the data for a "dodged" histogram based on 
whether or not a specific variable has a value in the first bin. 
 
I would like to be able to absolutely force the order of the variables in the 
bin.  For example, say I have three variables Me, You, and Them. 
 
Me_df<-data.frame(Data = c(1:15), Person = "Me")
You_df<-data.frame(Data = c(10:20), Person = "You")
Them_df<-data.frame(Data = c(15:25), Person = "Them")
Group_df_tmp<-rbind(Me_df,You_df)
Group_df<-rbind(Group_df_tmp,Them_df)
counts <- ddply(Group_df, .(cut(Data, breaks=fullseq(range(Data), 5)), Person), 
nrow) 
names(counts) <- c("Bin", "Person", "Frequency")
qplot(Person, Frequency, data = counts, fill = Person, geom="bar", 
stat="identity", width = 0.9, xlab="Person") +  facet_grid(. ~ Bin) 
 
However, I absolutely must have the bar order be Them, You, Me.   Is there a to 
fix the order of the bars so that they are always in the Them, You, Me order? 
 
Thank you again for any feedback you can provide.  
 
 


      
        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to