Is this what you want? temp<-c(rep("Low",2),rep("Medium",2),rep("High",2)) light<-rep(c("Dark","light"),3) avg<-dat.avg2[,3] # se<-dat.avg2[,4] dat.avg.temp<-data.frame(cbind(avg,se)) dat.avg.temp<-data.frame(cbind(temp,light,dat.avg.temp)) dat.plot<-qplot(light,avg, fill=factor(temp),data=dat.avg.temp, geom="bar", position="dodge") + scale_fill_discrete("Temp",labels=c('Low','Medium','High')) dat.plot
Felipe D. Carrillo Supervisory Fishery Biologist Department of the Interior US Fish & Wildlife Service California, USA --- On Wed, 10/14/09, Wade Wall <wade.w...@gmail.com> wrote: > From: Wade Wall <wade.w...@gmail.com> > Subject: change order of bar plot categories > To: "ggplot2" <ggpl...@googlegroups.com> > Date: Wednesday, October 14, 2009, 12:40 PM > > Hi all, > > I am trying to change the order of bar plot categories, and > not sure > how to do. I am graphing temperature means (low, > medium, and high) > and want them in increasing temperature order, but qplot > puts them in > alphabetical order. Any way to manually instruct > qplot regarding the > order. > > Here is some example code. The temperatures are > arranged in the order > I would like them (first column). > > temp<-c(rep("Low",2),rep("Medium",2),rep("High",2)) > light<-rep(c("Dark","light"),3) > avg<-dat.avg2[,3] > se<-dat.avg2[,4] > dat.avg.temp<-data.frame(cbind(avg,se)) > dat.avg.temp<-data.frame(cbind(temp,light,dat.avg.temp)) > dat.plot<-qplot(light,avg, > fill=factor(temp),data=dat.avg.temp, > geom="bar", position="dodge") > > Any help would be appreciated, > > Wade > > --~--~---------~--~----~------------~-------~--~----~ > You received this message because you are subscribed to the > ggplot2 mailing list. > To post to this group, send email to ggpl...@googlegroups.com > To unsubscribe from this group, send email to > ggplot2+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/ggplot2 > -~----------~----~----~----~------~----~------~--~--- > > ______________________________________________ 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.