BUG: Area plot overwrites matplotlib's default share y axes behaviour (original) (raw)
- 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.
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'])
