This is a [classic question](http://stackoverflow.com/questions/5208679/order-bars-in-ggplot2-bar-graph) in ggplot2 for R. Here's a simple reproducible example in python. This code: ``` python from ggplot import * p = ggplot(aes(x = 'cut', y = 'carat'), data=diamonds) p = p + geom_bar() p ``` Produces this bar chart:  If I wanted to reorder the bins (by count, in this example) ``` python diamonds.groupby('cut').count().sort(columns=['carat'], ascending=False)['carat'] ``` so that they appeared in this order from left-to-right in the plot ``` cut Ideal 21551 Premium 13791 Very Good 12082 Good 4906 Fair 1610 Name: carat, dtype: int64 ``` how would I do that?