title: How to apply custom column order (on Categorical) to pandas boxplot?
body: <p>EDIT: this question arose back in 2013 with pandas ~0.13 and was obsoleted by direct support for boxplot somewhere between version 0.15-0.18 (as per <a href="https://stackoverflow.com/a/44057503/202229">@Cireo's late answer</a>; also pandas greatly improved support for categorical since this was asked.)</p>
  <hr />
  <p>I can get a <code>boxplot</code> of a salary column in a pandas DataFrame...</p>
  <pre><code>train.boxplot(column='Salary', by='Category', sym='')
  </code></pre>
  <p>...however I can't figure out how to <strong>define the index-order used on column 'Category' - I want to supply my own custom order</strong>, according to another criterion:</p>
  <pre><code>category_order_by_mean_salary = train.groupby('Category')['Salary'].mean().order().keys()
  </code></pre>
  <p>How can I apply my custom column order to the boxplot columns? (other than ugly kludging the column names with a prefix to force ordering)</p>
  <p>'Category' is a string (really, should be a categorical, but this was back in 0.13, where categorical was a third-class citizen) column taking 27 distinct values: <code>['Accounting &amp; Finance Jobs','Admin Jobs',...,'Travel Jobs']</code>. So it can be easily factorized with <code>pd.Categorical.from_array()</code></p>
  <p>On inspection, the limitation is inside <strong><code>pandas.tools.plotting.py:boxplot()</code></strong>, which converts the column object without allowing ordering:</p>
  <ul>
  <li><a href="https://github.com/pydata/pandas/blob/master/pandas/core/frame.py" rel="nofollow noreferrer">pandas.core.frame.py.boxplot()</a> is a passthrough to</li>
  <li><strong><a href="https://github.com/pydata/pandas/blob/master/pandas/tools/plotting.py" rel="nofollow noreferrer">pandas.tools.plotting.py:boxplot()</a></strong>
  which instantiates ...</li>
  <li><a href="https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/pyplot.py" rel="nofollow noreferrer">matplotlib.pyplot.py:boxplot()</a> which instantiates ...</li>
  <li><a href="https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/axes.py" rel="nofollow noreferrer">matplotlib.axes.py:boxplot()</a></li>
  </ul>
  <p>I suppose I could either hack up a custom version of pandas boxplot(), or reach into the internals of the object. And also file an enhance request.</p>