Intelligently flip a plot with discrete data on the X axis.
This function puts the samples that were near the left origin on the X at the top on the Y axis, making them more human readable.
To my knowledge, there's not an easy way to create a
(via CoordFlip ggproto call internally) that lets you reorder the samples
on the Y-axis to be reversed. So this function works directly on the
ggplot object instead of a
ggproto, and therefore doesn't currently
library(ggplot2) g <- ggplot(data = mpg, aes(x = class)) + geom_bar() ## Notice the difference in Y axis sample order. g + coord_flip()g %>% acid_coord_flip()