I have been searching for a solution to order my bars in a bar chart in descending order. I have seen the "reorder" function for example. However, my y-values (so the counts for all my x-values) is not counted beforehand. However, I use the stat="count" function in aes.
Here is the code I use to plot:
ggplot(data[correctAnswer==3&conditionTemp=="uni"], aes(x=colorAnswers)) +
geom_bar(aes(stat = "count"), width=0.6, color = "black", fill="blueviolet")+theme_classic()
Currently the bars are ordered alphabetically (My x-values are categories such as "black", "white" etc).
Is there a way to order them, without counting assurances beforehand and creating a new columnn or summarised data frame?
Thanks!