groupby boxplot creates more subplots than are needed · Issue #6769 · pandas-dev/pandas (original) (raw)

When calling boxplot on a DataFrameGroupBy object, it does not seem to be able to properly infer the number of subplots required to account for the number of groups. For example, the following:

lsl_dr[lsl_dr.test_type==t].groupby('type').boxplot(column='score', grid=False)

generates this plot:

bad boxplot

Notice that it generates a 2x2 grid, even though there are only three groups. I thought I could deal with this manually by calling pyplot.subplots(1,3), but the boxplot method does not appear to be able to accept an axis argument like the DataFrame.boxplot method does. Is there a work-around for this?