I realise that inverting an axis is usually achieved by scale_y_reverse()
, but why does an inverted coordinate system not work also?
library(ggplot2)
# Basic chart
ggplot(mtcars, aes(cyl, mpg)) + geom_point()
# Yep, this transforms the axis as expected
ggplot(mtcars, aes(cyl, mpg)) + geom_point() + coord_trans(y = scales::log10_trans())
# This doesn't reverse the axis as you might expect, but it does change the default ticks
ggplot(mtcars, aes(cyl, mpg)) + geom_point() + coord_trans(y = scales::reverse_trans())
# (And yes I realise this is the 'correct' way to achieve this.)
ggplot(mtcars, aes(cyl, mpg)) + geom_point() + scale_y_reverse()