Hi Tobias and Felipe,
Both of your methods changed to the labels (L,M,H), but not the
corresponding values. The methods graph L as H, M as L, and M and H.
I have had display problems using ggplot2 before, but it seemed as if
it was because I was using Windows XP. I ran the current code using
Ubuntu 9.04 and got the same display issue.
Here is the code again, because I forgot to hard code the numbers.
temp<-factor(c(rep("Low",2),rep("Medium",2),rep("High",2)))
levels = c("Low", "Medium", "High"))
light<-rep(c("Dark","light"),3)
avg<-c(0.5200000,0.7800000, 0.3000000, 0.6000000, 0.0600000, 0.6078431)
se<-c(0.07065409, 0.05858327, 0.06480741, 0.06928203, 0.03358571, 0.06904634)
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
Thanks again for any help.
Wade
On Wed, Oct 14, 2009 at 4:19 PM, Felipe Carrillo
<mazatlanmexico at yahoo.com> wrote:> 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.wall at gmail.com> wrote:
>
>> From: Wade Wall <wade.wall at gmail.com>
>> Subject: change order of bar plot categories
>> To: "ggplot2" <ggplot2 at 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 ggplot2 at googlegroups.com
>> To unsubscribe from this group, send email to
>> ggplot2+unsubscribe at googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/ggplot2
>> -~----------~----~----~----~------~----~------~--~---
>>
>>
>
>
>
>