I am using the
ggridges packages to plot a
geom_density_ridges. I am looking to reverse the order of the y-axis, even though it is categorical. I tried
scale_y_continuous(trans = "reverse") (from https://stackoverflow.com/questions/28391850/r-reverse-order-of-discrete-y-axis-in-ggplot2 ), but that answer did not work for me since the axis labels cannot be coerced to numeric..
As I was typing up this question, I figured out a way to solve it - by adding in a line
mutate(y = fct_rev(as_factor(y)))
before the ggplot call, but that seems a bit indirect to me. Is there another way (fully within
ggplot2 to do the same thing)?