pydata/pandas — pull request #7035 by sinhrks (2014-05-04 23:16:27+00:00)
Title: ENH/BUG: boxplot now supports layout

Closes #6769. Added `layout` kw to `boxplot`. I think tests can be improved if boxplot can return ndarray with the same shape as layout, as the same manner as hist (maybe after #4472).

## Bug fix
It includes the fix to hide unnecessary axes than required in boxplot and hist. For example, `layout=(2, 2)` is specified for 3 subplots. I've listed affected cases as below.

```
# BoxPlot

# specify 3 columns with by keyword -> should be 3 axes in (2, 2) layout
df.boxplot(column=['values', 'values2', 'values3'], by='2g')

# groupby results in 3 groups -> should be 3 axes
df.groupby('3g').boxplot()

# groupby results in 3 groups, with column kw -> should be 3 axes in (2, 2) layout
df.groupby('3g').boxplot(column=['values', 'values2', 'values3'])

# Histogram

# specify 3 columns without by kw -> should be 3 axes in (2, 2) layout
df.hist(column=['values', 'values2', 'values3'])

# groupby results 3 groups results of by kw -> should be 3 axes in (2, 2) layout
df.hist(column=['values'], by='3g')
# This results KeyError: '3g' in current master, and the error has been fixed.

# groupby results in 3 groups -> should be 3 axes in (2, 2) layout
df.hist(by='3g')

# layout contains more size than groups -> should be 2 axes in specified layout
df.hist(by='2g', layout=(2, 2))
```