Skip to content

Add sharex and sharey to grouped boxplot #8008

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions pandas/tools/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -2685,7 +2685,7 @@ def plot_group(group, ax):

def boxplot_frame_groupby(grouped, subplots=True, column=None, fontsize=None,
rot=0, grid=True, ax=None, figsize=None,
layout=None, **kwds):
layout=None, sharex=False, sharey=False, **kwds):
"""
Make box plots from DataFrameGroupBy data.

Expand All @@ -2703,6 +2703,8 @@ def boxplot_frame_groupby(grouped, subplots=True, column=None, fontsize=None,
figsize : A tuple (width, height) in inches
layout : tuple (optional)
(rows, columns) for the layout of the plot
sharex: boolean, default False
sharey: boolean, default False
kwds : other plotting keyword arguments to be passed to matplotlib boxplot
function

Expand Down Expand Up @@ -2732,7 +2734,7 @@ def boxplot_frame_groupby(grouped, subplots=True, column=None, fontsize=None,
naxes = len(grouped)
nrows, ncols = _get_layout(naxes, layout=layout)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It changes current default?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does change the default ... (not to would be to have sharex default to False and sharey default to True). But I changed this to match DataFrame.hist and it makes more sense anyways. Let me know if I should change it to not modify the current default.

fig, axes = _subplots(nrows=nrows, ncols=ncols, naxes=naxes, squeeze=False,
ax=ax, sharex=False, sharey=True, figsize=figsize)
ax=ax, sharex=sharex, sharey=sharey, figsize=figsize)
axes = _flatten(axes)

ret = compat.OrderedDict()
Expand Down