I have a DF in which the levels of the column I use as the X axis variable are organized in an order that I want. However, when I plot the data using the following code:
plot.name = ggplot(df, aes(x=type, y=rating, fill=answer)) +
geom_bar(position=position_dodge(), stat="identity", width = .5) +
geom_errorbar(aes(ymin=rating-se, ymax=rating+se),
width=.2, # Width of the error bars
position=position_dodge(.5)) +
coord_cartesian(ylim=c(1,5))+
scale_fill_manual(values = c("#aaadad", "#343837")) +
theme(legend.position = "bottom")
The plot seems to have the x-axis variable organized in alphebatical order. How can I resolve this? Shouldn't the plotting order reflect the df order?