I have tried to plot a standard bar plot using code:
dat2<-data.frame(Ramp = rep(c("Low","Mid","MidHigh", "High"),each = 2),
score=rep(c("Average Score", "Top Score"), 2),
score.1=c(23.89,23.89,7.31,2.54,10.18,8.70,
3.17,2.00))
plot2<- ggplot(data=dat2,aes(x=score, y=score.1, fill = Ramp)) +
geom_bar(stat="identity", position = position_dodge(),
width = .8) +
theme_classic()
colour2<- scale_fill_grey(limits = c("Low","Mid","MidHigh","High"))
plot2 + colour2
This results in a plot in which the legend is in the correct order, but the factors in the x-axis are not in the correct order. How do I change it to match the order of the legend?
The plot currently looks like: