Skip to content
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

BUG: Area plot overwrites matplotlib's default share y axes behaviour #37942

Closed
3 tasks done
lrusnac opened this issue Nov 18, 2020 · 0 comments · Fixed by #37943
Closed
3 tasks done

BUG: Area plot overwrites matplotlib's default share y axes behaviour #37942

lrusnac opened this issue Nov 18, 2020 · 0 comments · Fixed by #37943
Labels
Milestone

Comments

@lrusnac
Copy link
Contributor

lrusnac commented Nov 18, 2020

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pandas.

  • (optional) I have confirmed this bug exists on the master branch of pandas.


Code Sample, a copy-pastable example

import pandas as pd
import matplotlib.pyplot as plt

df0 = pd.DataFrame([{'a': 10, 'b': 12}, {'a': 13, 'b': 9}])
df1 = pd.DataFrame([{'a': 100, 'b': 120}, {'a': 130, 'b': 90}])

fig, (axes_0, axes_1) = plt.subplots(1, 2, figsize=(12, 6), sharey='row')
df0.plot(ax=axes_0, kind='area')
df1.plot(ax=axes_1, kind='area')

Problem description

The area plot overwrites matplotlib's share y axes behaviour if sharey parameter is not passed to .plot and as a result the second plot get's cut off.
Screenshot 2020-11-18 at 18 55 02

Expected Output

same plot made directly with matplotlib, expected behaviour:

fig, (axes_0, axes_1) = plt.subplots(1, 2, figsize=(12, 6), sharey='row')
axes_0.stackplot(df0.index, df0['a'], df0['b'])
axes_1.stackplot(df1.index, df1['a'], df1['b'])

Screenshot 2020-11-18 at 18 56 54

@lrusnac lrusnac added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Nov 18, 2020
@lrusnac lrusnac changed the title BUG: Area plot share y overwrites matplotlib's default behaviour BUG: Area plot overwrites matplotlib's default share y axes behaviour Nov 18, 2020
@jreback jreback added Visualization plotting and removed Needs Triage Issue that has not been reviewed by a pandas team member labels Nov 19, 2020
@jreback jreback added this to the 1.2 milestone Nov 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants