order my bar plot in order of condition ggplot2

Viewed 26

I have a bar plot with mean and sd plotted for each sample. I want to order the bar plots based on condition but they are being plotted on the x axis in alphabetical order of the sample names. This is the code I used to get the plot. Any help is appreciated.

ggplot(df, aes(x = Samples,y=Mean, fill = Condition, order=Condition)) + geom_bar(position=position_dodge(), stat="identity",
           colour='black') +
  geom_errorbar(aes(ymin=Mean-sd, ymax=Mean+sd),  position = position_dodge(width = 0.9))+
  coord_flip()

My data frame is here:

Data Frame

Bar Plot

0 Answers
Related