Plotting in a specific axis with DataFrame.hist(by=) is not working as expected · Issue #5353 · pandas-dev/pandas (original) (raw)

Hi,
I posted this on stackoverflow http://stackoverflow.com/questions/19602864/how-to-plot-in-a-specific-axis-with-dataframe-histby-in-pandas?noredirect=1#comment29118427_19602864 and was suggested to file a bug report here.

I am trying plot several histogram groups in the same figure. Each group contains two conditions and I am therefore using the 'by=' argument from pandas histogram options. However, this does not work as I expected and pandas creates a new figure instead of plotting in the axis I am passing. I tried to pass four axes as well, but still no go. Sample code:

import pandas as pd df = pd.DataFrame({'color': ['blue','blue','yellow','blue','yellow'], 'area': [2,2,3,4,4]}) fig, (ax1, ax2) = plt.subplots(1,2) df.area.hist(by=df.color, ax=ax1)

I'm using pandas 0.12.0, matplotlib 1.3.0, numpy 1.7.1 and python 2.7.5. Any suggestion that leads to a way of combining/stitching multiple 'hist(by=)-plots' in the same subplot grid is welcome.