I am trying to plot a bar plot with study names on the x-axis and a total score on some measurement on the y-axis. In order to make the graph more readable, I flipped the coordinate systems so that the study names are presented on the left now. However, now I can't change the order of the bars anymore. I want it to be order in alphabetical order going from a-z rather than the other way around (which is the case in my plot).
As you can see in the picture below, the bars start with Wright (2018) and end with Alford (2012). I would like to have it the other way around.
data.quality %>%
ggplot(aes(x = study, y = score)) +
geom_bar(stat = "identity", fill = "#66c2a5") +
coord_flip() +
scale_y_continuous(name = "Total quality score", limits = c(0, 7),
breaks = 0:7) +
scale_x_discrete(name = element_blank()) +
theme(axis.ticks.y = element_blank())
I have already tried to use reorder():
ggplot(aes(x = study, y = reorder(score, -study)))
But that doesn't work because study is a string.
Thank you, Matthias