The cowplot library has this object:
library(cowplot)
gpv <- ggplot(mpg, aes(displ, factor(cyl))) +
geom_point()
ggdraw( switch_axis_position( gpv, axis="y", keep="y"))
Do not forget that when sending to a file you need printmesh graphics:
png()
print(ggdraw(switch_axis_position(gpv, axis="y", keep="y")) )
dev.off()

source
share