Sharey keyword for boxplot
State: closed

…to _subplots().

.. code-block:: jupyter-notebook

   %pylab inline
    import pandas as pd

    N = 100
    rand = random.random(N)
    clas = random.binomial(5,.5, N)
    df = pd.DataFrame({'Rand': rand-clas,
                    'Rand2': rand,
                    'Class': clas},
                    index= np.arange(N))

    df.groupby('Class').boxplot(sharey=True, sharex=False)
    >>> TypeError: boxplot() got an unexpected keyword argument 'sharey'

New Behavior:

.. ipython:: jpyter-notebook:

    ...

    df.groupby('Class').boxplot(sharey=True, sharex=True)
    df.groupby('Class').boxplot(sharey=True, sharex=False)
    df.groupby('Class').boxplot(sharey=False, sharex=True)
    df.groupby('Class').boxplot(sharey=False, sharex=False)

    All leads to different behaviour. The shareing of axes both x and y
    can be turned on and off separately. 

To restore previous behavior, use boxplot() without keywords.

Default is the previous behavior of sharey
- [x ] closes #20918
- [x ] tests added / passed
- [ x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [x ] whatsnew entry


Labels:
name: Enhancement
name: Visualization
description: plotting

Comments:
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/20968?src=pr&el=h1) Report
> Merging [#20968](https://codecov.io/gh/pandas-dev/pandas/pull/20968?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/abfac97b2d22447d41bfccaa53e0a264ca34d6d4?src=pr&el=desc) will **increase** coverage by `0.03%`.
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/20968/graphs/tree.svg?token=eZ4WkYLtcO&src=pr&height=150&width=650)](https://codecov.io/gh/pandas-dev/pandas/pull/20968?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #20968      +/-   ##
==========================================
+ Coverage   91.85%   91.88%   +0.03%     
==========================================
  Files         153      153              
  Lines       49570    49564       -6     
==========================================
+ Hits        45533    45543      +10     
+ Misses       4037     4021      -16
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.28% <ø> (+0.03%)` | :arrow_up: |
| #single | `41.86% <ø> (ø)` | :arrow_up: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/20968?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/plotting/\_core.py](https://codecov.io/gh/pandas-dev/pandas/pull/20968/diff?src=pr&el=tree#diff-cGFuZGFzL3Bsb3R0aW5nL19jb3JlLnB5) | `83.53% <ø> (+1.14%)` | :arrow_up: |
| [pandas/core/reshape/pivot.py](https://codecov.io/gh/pandas-dev/pandas/pull/20968/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvcmVzaGFwZS9waXZvdC5weQ==) | `96.97% <0%> (-0.06%)` | :arrow_down: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/20968?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/20968?src=pr&el=footer). Last update [abfac97...fd76955](https://codecov.io/gh/pandas-dev/pandas/pull/20968?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

We'll want tests for this. See the e.g. `test_sharex_and_ax` in pandas/tests/plotting/test_frame.py for an example.
Thanks. I will look into that and give it a try.
Hello @soerendip! Thanks for updating the PR.





Cheers ! There are no PEP8 issues in this Pull Request. :beers: 

##### Comment last updated on June 08, 2018 at 11:26 Hours UTC
Done. Hope it is correct this time.
Any updates on this? I shortened the tests in the style of your examples using the assert function that was implemented to check for visibility. However, I had to create two helper functions, and was not sure where the optimal place for those is. 
All changes should be done.
@soerendip looks like tests are failing in the latest commit.
That’s when you think “it’s so easy it can’t fail”... will look into this.

________________________________
From: Tom Augspurger <notifications@github.com>
Sent: Wednesday, June 6, 2018 2:31:23 PM
To: pandas-dev/pandas
Cc: Sören; Mention
Subject: Re: [pandas-dev/pandas] Sharey keyword for boxplot (#20968)


@soerendip<https://github.com/soerendip> looks like tests are failing in the latest commit.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<https://github.com/pandas-dev/pandas/pull/20968#issuecomment-395220312>, or mute the thread<https://github.com/notifications/unsubscribe-auth/ADPAfiKwkip_0MRFE3KD0qoRShVy2QZ0ks5t6EorgaJpZM4T0HJx>.

Done.
thanks @soerendip