Can someone explain me how i reorder the boxplots for the x-axis in ggplot2.
I tried following Code:
ggplot(data = HxH)+
geom_boxplot(aes(x = NenUsers,
y = AbilityRating),
na.rm = TRUE) +
labs(x ="Nen",
y ="Ability",
title = "NenUsers and their Ability")+
theme_bw()
After i run the code the boxplots dont appear in the right order in regard of the median.
Is there an easy way to reorder the x-axis?
If you want the categories on the x axis to be ordered according to the median of AbilityRating, you can use the fct_reorder() function from the forcats package.