How to sort a boxplot by the median values in pandas

Posted by Chris on Stack Overflow See other posts from Stack Overflow or by Chris
Published on 2013-10-19T18:32:48Z Indexed on 2013/10/19 21:55 UTC
Read the original article Hit count: 464

Filed under:
|
|
|

I've got a dataframe outcome2 that I generate a grouped boxplot with in the following manner:

In [11]: outcome2.boxplot(column='Hospital 30-Day Death (Mortality) Rates from Heart Attack',by='State')
        plt.ylabel('30 Day Death Rate')
        plt.title('30 Day Death Rate by State')
Out [11]:

enter image description here

What I'd like to do is sort the plot by the median for each state, instead of alphabetically. Not sure how to go about doing so.

© Stack Overflow or respective owner

Related posts about python

Related posts about matplotlib