Reordering geom_bar and geom_col by Count or Value
One of the things I’m always looking up with ggplot2 is how to reorder the bars in my bar charts by their length (i.e. the count/frequency or value, depending on whether you’re using geom_bar or geom_col). If you do a Google search, there are multiple different solutions, but I will document in this post what I’ve found to be the cleanest and simplest solution.1
Reordering geom_bar by count By default, the bars are arranged by the order (levels) of the factor variable.