From fa60a3989e6a7bffa2303fbc3590c9132493969d Mon Sep 17 00:00:00 2001 From: Thomas Li <47963215+lithomas1@users.noreply.github.com> Date: Thu, 18 Nov 2021 17:13:31 -0800 Subject: [PATCH 1/7] COMPAT: Matplotlib 3.5.0 --- pandas/plotting/_matplotlib/compat.py | 1 + pandas/tests/plotting/common.py | 10 ++++++ pandas/tests/plotting/frame/test_frame.py | 5 +-- .../tests/plotting/frame/test_hist_box_by.py | 34 ++++++++++--------- pandas/tests/plotting/test_hist_method.py | 26 +++++++------- pandas/tests/plotting/test_series.py | 5 +-- 6 files changed, 49 insertions(+), 32 deletions(-) diff --git a/pandas/plotting/_matplotlib/compat.py b/pandas/plotting/_matplotlib/compat.py index 70ddd1ca09c7e..5569b1f2979b0 100644 --- a/pandas/plotting/_matplotlib/compat.py +++ b/pandas/plotting/_matplotlib/compat.py @@ -24,3 +24,4 @@ def inner(): mpl_ge_3_2_0 = _mpl_version("3.2.0", operator.ge) mpl_ge_3_3_0 = _mpl_version("3.3.0", operator.ge) mpl_ge_3_4_0 = _mpl_version("3.4.0", operator.ge) +mpl_ge_3_5_0 = _mpl_version("3.5.0", operator.ge) diff --git a/pandas/tests/plotting/common.py b/pandas/tests/plotting/common.py index e2b6b5ab3319c..63cf55f6c393c 100644 --- a/pandas/tests/plotting/common.py +++ b/pandas/tests/plotting/common.py @@ -29,6 +29,8 @@ ) import pandas._testing as tm +from pandas.plotting._matplotlib import compat + if TYPE_CHECKING: from matplotlib.axes import Axes @@ -653,3 +655,11 @@ def _gen_two_subplots(f, fig, **kwargs): def curpath(): pth, _ = os.path.split(os.path.abspath(__file__)) return pth + + +get_x_axis = ( + lambda ax: ax._shared_axes["x"] if compat.mpl_ge_3_5_0() else ax._shared_x_axes +) +get_y_axis = ( + lambda ax: ax._shared_axes["y"] if compat.mpl_ge_3_5_0() else ax._shared_y_axes +) diff --git a/pandas/tests/plotting/frame/test_frame.py b/pandas/tests/plotting/frame/test_frame.py index ccd0bc3d16896..a647040affc19 100644 --- a/pandas/tests/plotting/frame/test_frame.py +++ b/pandas/tests/plotting/frame/test_frame.py @@ -28,6 +28,7 @@ from pandas.tests.plotting.common import ( TestPlotBase, _check_plot_works, + get_y_axis, ) from pandas.io.formats.printing import pprint_thing @@ -525,8 +526,8 @@ def test_area_sharey_dont_overwrite(self): df.plot(ax=ax1, kind="area") df.plot(ax=ax2, kind="area") - assert ax1._shared_y_axes.joined(ax1, ax2) - assert ax2._shared_y_axes.joined(ax1, ax2) + assert get_y_axis(ax1).joined(ax1, ax2) + assert get_y_axis(ax2).joined(ax1, ax2) def test_bar_linewidth(self): df = DataFrame(np.random.randn(5, 5)) diff --git a/pandas/tests/plotting/frame/test_hist_box_by.py b/pandas/tests/plotting/frame/test_hist_box_by.py index ba6d232733762..f3aafb9c821e2 100644 --- a/pandas/tests/plotting/frame/test_hist_box_by.py +++ b/pandas/tests/plotting/frame/test_hist_box_by.py @@ -10,6 +10,8 @@ from pandas.tests.plotting.common import ( TestPlotBase, _check_plot_works, + get_x_axis, + get_y_axis, ) @@ -195,16 +197,16 @@ def test_axis_share_x_with_by(self): ax1, ax2, ax3 = self.hist_df.plot.hist(column="A", by="C", sharex=True) # share x - assert ax1._shared_x_axes.joined(ax1, ax2) - assert ax2._shared_x_axes.joined(ax1, ax2) - assert ax3._shared_x_axes.joined(ax1, ax3) - assert ax3._shared_x_axes.joined(ax2, ax3) + assert get_x_axis(ax1).joined(ax1, ax2) + assert get_x_axis(ax2).joined(ax1, ax2) + assert get_x_axis(ax3).joined(ax1, ax3) + assert get_x_axis(ax3).joined(ax2, ax3) # don't share y - assert not ax1._shared_y_axes.joined(ax1, ax2) - assert not ax2._shared_y_axes.joined(ax1, ax2) - assert not ax3._shared_y_axes.joined(ax1, ax3) - assert not ax3._shared_y_axes.joined(ax2, ax3) + assert not get_y_axis(ax1).joined(ax1, ax2) + assert not get_y_axis(ax2).joined(ax1, ax2) + assert not get_y_axis(ax3).joined(ax1, ax3) + assert not get_y_axis(ax3).joined(ax2, ax3) @pytest.mark.slow def test_axis_share_y_with_by(self): @@ -212,16 +214,16 @@ def test_axis_share_y_with_by(self): ax1, ax2, ax3 = self.hist_df.plot.hist(column="A", by="C", sharey=True) # share y - assert ax1._shared_y_axes.joined(ax1, ax2) - assert ax2._shared_y_axes.joined(ax1, ax2) - assert ax3._shared_y_axes.joined(ax1, ax3) - assert ax3._shared_y_axes.joined(ax2, ax3) + assert get_y_axis(ax1).joined(ax1, ax2) + assert get_y_axis(ax2).joined(ax1, ax2) + assert get_y_axis(ax3).joined(ax1, ax3) + assert get_y_axis(ax3).joined(ax2, ax3) # don't share x - assert not ax1._shared_x_axes.joined(ax1, ax2) - assert not ax2._shared_x_axes.joined(ax1, ax2) - assert not ax3._shared_x_axes.joined(ax1, ax3) - assert not ax3._shared_x_axes.joined(ax2, ax3) + assert not get_x_axis(ax1).joined(ax1, ax2) + assert not get_x_axis(ax2).joined(ax1, ax2) + assert not get_x_axis(ax3).joined(ax1, ax3) + assert not get_x_axis(ax3).joined(ax2, ax3) @pytest.mark.parametrize("figsize", [(12, 8), (20, 10)]) def test_figure_shape_hist_with_by(self, figsize): diff --git a/pandas/tests/plotting/test_hist_method.py b/pandas/tests/plotting/test_hist_method.py index 96fdcebc9b8f7..06d4ef3f15f1d 100644 --- a/pandas/tests/plotting/test_hist_method.py +++ b/pandas/tests/plotting/test_hist_method.py @@ -16,6 +16,8 @@ from pandas.tests.plotting.common import ( TestPlotBase, _check_plot_works, + get_x_axis, + get_y_axis, ) pytestmark = pytest.mark.slow @@ -728,35 +730,35 @@ def test_axis_share_x(self): ax1, ax2 = df.hist(column="height", by=df.gender, sharex=True) # share x - assert ax1._shared_x_axes.joined(ax1, ax2) - assert ax2._shared_x_axes.joined(ax1, ax2) + assert get_x_axis(ax1).joined(ax1, ax2) + assert get_x_axis(ax2).joined(ax1, ax2) # don't share y - assert not ax1._shared_y_axes.joined(ax1, ax2) - assert not ax2._shared_y_axes.joined(ax1, ax2) + assert not get_y_axis(ax1).joined(ax1, ax2) + assert not get_y_axis(ax2).joined(ax1, ax2) def test_axis_share_y(self): df = self.hist_df ax1, ax2 = df.hist(column="height", by=df.gender, sharey=True) # share y - assert ax1._shared_y_axes.joined(ax1, ax2) - assert ax2._shared_y_axes.joined(ax1, ax2) + assert get_y_axis(ax1).joined(ax1, ax2) + assert get_y_axis(ax2).joined(ax1, ax2) # don't share x - assert not ax1._shared_x_axes.joined(ax1, ax2) - assert not ax2._shared_x_axes.joined(ax1, ax2) + assert not get_x_axis(ax1).joined(ax1, ax2) + assert not get_x_axis(ax2).joined(ax1, ax2) def test_axis_share_xy(self): df = self.hist_df ax1, ax2 = df.hist(column="height", by=df.gender, sharex=True, sharey=True) # share both x and y - assert ax1._shared_x_axes.joined(ax1, ax2) - assert ax2._shared_x_axes.joined(ax1, ax2) + assert get_x_axis(ax1).joined(ax1, ax2) + assert get_x_axis(ax2).joined(ax1, ax2) - assert ax1._shared_y_axes.joined(ax1, ax2) - assert ax2._shared_y_axes.joined(ax1, ax2) + assert get_y_axis(ax1).joined(ax1, ax2) + assert get_y_axis(ax2).joined(ax1, ax2) @pytest.mark.parametrize( "histtype, expected", diff --git a/pandas/tests/plotting/test_series.py b/pandas/tests/plotting/test_series.py index 812aae8d97151..1d1a0f461d770 100644 --- a/pandas/tests/plotting/test_series.py +++ b/pandas/tests/plotting/test_series.py @@ -19,6 +19,7 @@ from pandas.tests.plotting.common import ( TestPlotBase, _check_plot_works, + get_y_axis, ) import pandas.plotting as plotting @@ -154,8 +155,8 @@ def test_area_sharey_dont_overwrite(self): abs(self.ts).plot(ax=ax1, kind="area") abs(self.ts).plot(ax=ax2, kind="area") - assert ax1._shared_y_axes.joined(ax1, ax2) - assert ax2._shared_y_axes.joined(ax1, ax2) + assert get_y_axis(ax1).joined(ax1, ax2) + assert get_y_axis(ax2).joined(ax1, ax2) def test_label(self): s = Series([1, 2]) From 6528b776c97066efc96afee0cfb499cf1b424a6b Mon Sep 17 00:00:00 2001 From: Thomas Li <47963215+lithomas1@users.noreply.github.com> Date: Thu, 18 Nov 2021 18:06:23 -0800 Subject: [PATCH 2/7] try another way --- pandas/tests/plotting/common.py | 18 +++++----- pandas/tests/plotting/frame/test_frame.py | 5 ++- .../tests/plotting/frame/test_hist_box_by.py | 34 +++++++++---------- pandas/tests/plotting/test_hist_method.py | 26 +++++++------- pandas/tests/plotting/test_series.py | 5 ++- 5 files changed, 40 insertions(+), 48 deletions(-) diff --git a/pandas/tests/plotting/common.py b/pandas/tests/plotting/common.py index 63cf55f6c393c..52127b926f1fa 100644 --- a/pandas/tests/plotting/common.py +++ b/pandas/tests/plotting/common.py @@ -29,8 +29,6 @@ ) import pandas._testing as tm -from pandas.plotting._matplotlib import compat - if TYPE_CHECKING: from matplotlib.axes import Axes @@ -47,6 +45,8 @@ def setup_method(self, method): from pandas.plotting._matplotlib import compat + self.compat = compat + mpl.rcdefaults() self.start_date_to_int64 = 812419200000000000 @@ -571,6 +571,12 @@ def _unpack_cycler(self, rcParams, field="color"): """ return [v[field] for v in rcParams["axes.prop_cycle"]] + def get_x_axis(self, ax): + return ax._shared_axes["x"] if self.compat.mpl_ge_3_5_0() else ax._shared_x_axes + + def get_y_axis(self, ax): + return ax._shared_axes["y"] if self.compat.mpl_ge_3_5_0() else ax._shared_y_axes + def _check_plot_works(f, filterwarnings="always", default_axes=False, **kwargs): """ @@ -655,11 +661,3 @@ def _gen_two_subplots(f, fig, **kwargs): def curpath(): pth, _ = os.path.split(os.path.abspath(__file__)) return pth - - -get_x_axis = ( - lambda ax: ax._shared_axes["x"] if compat.mpl_ge_3_5_0() else ax._shared_x_axes -) -get_y_axis = ( - lambda ax: ax._shared_axes["y"] if compat.mpl_ge_3_5_0() else ax._shared_y_axes -) diff --git a/pandas/tests/plotting/frame/test_frame.py b/pandas/tests/plotting/frame/test_frame.py index a647040affc19..2468acbdbd568 100644 --- a/pandas/tests/plotting/frame/test_frame.py +++ b/pandas/tests/plotting/frame/test_frame.py @@ -28,7 +28,6 @@ from pandas.tests.plotting.common import ( TestPlotBase, _check_plot_works, - get_y_axis, ) from pandas.io.formats.printing import pprint_thing @@ -526,8 +525,8 @@ def test_area_sharey_dont_overwrite(self): df.plot(ax=ax1, kind="area") df.plot(ax=ax2, kind="area") - assert get_y_axis(ax1).joined(ax1, ax2) - assert get_y_axis(ax2).joined(ax1, ax2) + assert self.get_x_axis(ax1).joined(ax1, ax2) + assert self.get_x_axis(ax2).joined(ax1, ax2) def test_bar_linewidth(self): df = DataFrame(np.random.randn(5, 5)) diff --git a/pandas/tests/plotting/frame/test_hist_box_by.py b/pandas/tests/plotting/frame/test_hist_box_by.py index f3aafb9c821e2..8c7b78a32c717 100644 --- a/pandas/tests/plotting/frame/test_hist_box_by.py +++ b/pandas/tests/plotting/frame/test_hist_box_by.py @@ -10,8 +10,6 @@ from pandas.tests.plotting.common import ( TestPlotBase, _check_plot_works, - get_x_axis, - get_y_axis, ) @@ -197,16 +195,16 @@ def test_axis_share_x_with_by(self): ax1, ax2, ax3 = self.hist_df.plot.hist(column="A", by="C", sharex=True) # share x - assert get_x_axis(ax1).joined(ax1, ax2) - assert get_x_axis(ax2).joined(ax1, ax2) - assert get_x_axis(ax3).joined(ax1, ax3) - assert get_x_axis(ax3).joined(ax2, ax3) + assert self.get_x_axis(ax1).joined(ax1, ax2) + assert self.get_x_axis(ax2).joined(ax1, ax2) + assert self.get_x_axis(ax3).joined(ax1, ax3) + assert self.get_x_axis(ax3).joined(ax2, ax3) # don't share y - assert not get_y_axis(ax1).joined(ax1, ax2) - assert not get_y_axis(ax2).joined(ax1, ax2) - assert not get_y_axis(ax3).joined(ax1, ax3) - assert not get_y_axis(ax3).joined(ax2, ax3) + assert not self.get_x_axis(ax1).joined(ax1, ax2) + assert not self.get_x_axis(ax2).joined(ax1, ax2) + assert not self.get_x_axis(ax3).joined(ax1, ax3) + assert not self.get_x_axis(ax3).joined(ax2, ax3) @pytest.mark.slow def test_axis_share_y_with_by(self): @@ -214,16 +212,16 @@ def test_axis_share_y_with_by(self): ax1, ax2, ax3 = self.hist_df.plot.hist(column="A", by="C", sharey=True) # share y - assert get_y_axis(ax1).joined(ax1, ax2) - assert get_y_axis(ax2).joined(ax1, ax2) - assert get_y_axis(ax3).joined(ax1, ax3) - assert get_y_axis(ax3).joined(ax2, ax3) + assert self.get_x_axis(ax1).joined(ax1, ax2) + assert self.get_x_axis(ax2).joined(ax1, ax2) + assert self.get_x_axis(ax3).joined(ax1, ax3) + assert self.get_x_axis(ax3).joined(ax2, ax3) # don't share x - assert not get_x_axis(ax1).joined(ax1, ax2) - assert not get_x_axis(ax2).joined(ax1, ax2) - assert not get_x_axis(ax3).joined(ax1, ax3) - assert not get_x_axis(ax3).joined(ax2, ax3) + assert not self.get_x_axis(ax1).joined(ax1, ax2) + assert not self.get_x_axis(ax2).joined(ax1, ax2) + assert not self.get_x_axis(ax3).joined(ax1, ax3) + assert not self.get_x_axis(ax3).joined(ax2, ax3) @pytest.mark.parametrize("figsize", [(12, 8), (20, 10)]) def test_figure_shape_hist_with_by(self, figsize): diff --git a/pandas/tests/plotting/test_hist_method.py b/pandas/tests/plotting/test_hist_method.py index 06d4ef3f15f1d..a28a73fbb40fb 100644 --- a/pandas/tests/plotting/test_hist_method.py +++ b/pandas/tests/plotting/test_hist_method.py @@ -16,8 +16,6 @@ from pandas.tests.plotting.common import ( TestPlotBase, _check_plot_works, - get_x_axis, - get_y_axis, ) pytestmark = pytest.mark.slow @@ -730,35 +728,35 @@ def test_axis_share_x(self): ax1, ax2 = df.hist(column="height", by=df.gender, sharex=True) # share x - assert get_x_axis(ax1).joined(ax1, ax2) - assert get_x_axis(ax2).joined(ax1, ax2) + assert self.get_x_axis(ax1).joined(ax1, ax2) + assert self.get_x_axis(ax2).joined(ax1, ax2) # don't share y - assert not get_y_axis(ax1).joined(ax1, ax2) - assert not get_y_axis(ax2).joined(ax1, ax2) + assert not self.get_x_axis(ax1).joined(ax1, ax2) + assert not self.get_x_axis(ax2).joined(ax1, ax2) def test_axis_share_y(self): df = self.hist_df ax1, ax2 = df.hist(column="height", by=df.gender, sharey=True) # share y - assert get_y_axis(ax1).joined(ax1, ax2) - assert get_y_axis(ax2).joined(ax1, ax2) + assert self.get_x_axis(ax1).joined(ax1, ax2) + assert self.get_x_axis(ax2).joined(ax1, ax2) # don't share x - assert not get_x_axis(ax1).joined(ax1, ax2) - assert not get_x_axis(ax2).joined(ax1, ax2) + assert not self.get_x_axis(ax1).joined(ax1, ax2) + assert not self.get_x_axis(ax2).joined(ax1, ax2) def test_axis_share_xy(self): df = self.hist_df ax1, ax2 = df.hist(column="height", by=df.gender, sharex=True, sharey=True) # share both x and y - assert get_x_axis(ax1).joined(ax1, ax2) - assert get_x_axis(ax2).joined(ax1, ax2) + assert self.get_x_axis(ax1).joined(ax1, ax2) + assert self.get_x_axis(ax2).joined(ax1, ax2) - assert get_y_axis(ax1).joined(ax1, ax2) - assert get_y_axis(ax2).joined(ax1, ax2) + assert self.get_x_axis(ax1).joined(ax1, ax2) + assert self.get_x_axis(ax2).joined(ax1, ax2) @pytest.mark.parametrize( "histtype, expected", diff --git a/pandas/tests/plotting/test_series.py b/pandas/tests/plotting/test_series.py index 1d1a0f461d770..512a83ca8ff92 100644 --- a/pandas/tests/plotting/test_series.py +++ b/pandas/tests/plotting/test_series.py @@ -19,7 +19,6 @@ from pandas.tests.plotting.common import ( TestPlotBase, _check_plot_works, - get_y_axis, ) import pandas.plotting as plotting @@ -155,8 +154,8 @@ def test_area_sharey_dont_overwrite(self): abs(self.ts).plot(ax=ax1, kind="area") abs(self.ts).plot(ax=ax2, kind="area") - assert get_y_axis(ax1).joined(ax1, ax2) - assert get_y_axis(ax2).joined(ax1, ax2) + assert self.get_x_axis(ax1).joined(ax1, ax2) + assert self.get_x_axis(ax2).joined(ax1, ax2) def test_label(self): s = Series([1, 2]) From 0d04a32d8289a174e8847ea57a3b113e4ebee339 Mon Sep 17 00:00:00 2001 From: Thomas Li <47963215+lithomas1@users.noreply.github.com> Date: Thu, 18 Nov 2021 18:09:24 -0800 Subject: [PATCH 3/7] typo --- pandas/tests/plotting/frame/test_hist_box_by.py | 16 ++++++++-------- pandas/tests/plotting/test_hist_method.py | 12 ++++++------ pandas/tests/plotting/test_series.py | 4 ++-- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/pandas/tests/plotting/frame/test_hist_box_by.py b/pandas/tests/plotting/frame/test_hist_box_by.py index 8c7b78a32c717..c92d952587967 100644 --- a/pandas/tests/plotting/frame/test_hist_box_by.py +++ b/pandas/tests/plotting/frame/test_hist_box_by.py @@ -201,10 +201,10 @@ def test_axis_share_x_with_by(self): assert self.get_x_axis(ax3).joined(ax2, ax3) # don't share y - assert not self.get_x_axis(ax1).joined(ax1, ax2) - assert not self.get_x_axis(ax2).joined(ax1, ax2) - assert not self.get_x_axis(ax3).joined(ax1, ax3) - assert not self.get_x_axis(ax3).joined(ax2, ax3) + assert not self.get_y_axis(ax1).joined(ax1, ax2) + assert not self.get_y_axis(ax2).joined(ax1, ax2) + assert not self.get_y_axis(ax3).joined(ax1, ax3) + assert not self.get_y_axis(ax3).joined(ax2, ax3) @pytest.mark.slow def test_axis_share_y_with_by(self): @@ -212,10 +212,10 @@ def test_axis_share_y_with_by(self): ax1, ax2, ax3 = self.hist_df.plot.hist(column="A", by="C", sharey=True) # share y - assert self.get_x_axis(ax1).joined(ax1, ax2) - assert self.get_x_axis(ax2).joined(ax1, ax2) - assert self.get_x_axis(ax3).joined(ax1, ax3) - assert self.get_x_axis(ax3).joined(ax2, ax3) + assert self.get_y_axis(ax1).joined(ax1, ax2) + assert self.get_y_axis(ax2).joined(ax1, ax2) + assert self.get_y_axis(ax3).joined(ax1, ax3) + assert self.get_y_axis(ax3).joined(ax2, ax3) # don't share x assert not self.get_x_axis(ax1).joined(ax1, ax2) diff --git a/pandas/tests/plotting/test_hist_method.py b/pandas/tests/plotting/test_hist_method.py index a28a73fbb40fb..403f4a2c06df1 100644 --- a/pandas/tests/plotting/test_hist_method.py +++ b/pandas/tests/plotting/test_hist_method.py @@ -732,16 +732,16 @@ def test_axis_share_x(self): assert self.get_x_axis(ax2).joined(ax1, ax2) # don't share y - assert not self.get_x_axis(ax1).joined(ax1, ax2) - assert not self.get_x_axis(ax2).joined(ax1, ax2) + assert not self.get_y_axis(ax1).joined(ax1, ax2) + assert not self.get_y_axis(ax2).joined(ax1, ax2) def test_axis_share_y(self): df = self.hist_df ax1, ax2 = df.hist(column="height", by=df.gender, sharey=True) # share y - assert self.get_x_axis(ax1).joined(ax1, ax2) - assert self.get_x_axis(ax2).joined(ax1, ax2) + assert self.get_y_axis(ax1).joined(ax1, ax2) + assert self.get_y_axis(ax2).joined(ax1, ax2) # don't share x assert not self.get_x_axis(ax1).joined(ax1, ax2) @@ -755,8 +755,8 @@ def test_axis_share_xy(self): assert self.get_x_axis(ax1).joined(ax1, ax2) assert self.get_x_axis(ax2).joined(ax1, ax2) - assert self.get_x_axis(ax1).joined(ax1, ax2) - assert self.get_x_axis(ax2).joined(ax1, ax2) + assert self.get_y_axis(ax1).joined(ax1, ax2) + assert self.get_y_axis(ax2).joined(ax1, ax2) @pytest.mark.parametrize( "histtype, expected", diff --git a/pandas/tests/plotting/test_series.py b/pandas/tests/plotting/test_series.py index 512a83ca8ff92..e40798f4f5125 100644 --- a/pandas/tests/plotting/test_series.py +++ b/pandas/tests/plotting/test_series.py @@ -154,8 +154,8 @@ def test_area_sharey_dont_overwrite(self): abs(self.ts).plot(ax=ax1, kind="area") abs(self.ts).plot(ax=ax2, kind="area") - assert self.get_x_axis(ax1).joined(ax1, ax2) - assert self.get_x_axis(ax2).joined(ax1, ax2) + assert self.get_y_axis(ax1).joined(ax1, ax2) + assert self.get_y_axis(ax2).joined(ax1, ax2) def test_label(self): s = Series([1, 2]) From 1a6dd92607303dc4f4c7005e0a4119b060ff19e7 Mon Sep 17 00:00:00 2001 From: Thomas Li <47963215+lithomas1@users.noreply.github.com> Date: Thu, 18 Nov 2021 18:11:12 -0800 Subject: [PATCH 4/7] one more typo --- pandas/tests/plotting/frame/test_frame.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandas/tests/plotting/frame/test_frame.py b/pandas/tests/plotting/frame/test_frame.py index 2468acbdbd568..6c07366e402d6 100644 --- a/pandas/tests/plotting/frame/test_frame.py +++ b/pandas/tests/plotting/frame/test_frame.py @@ -525,8 +525,8 @@ def test_area_sharey_dont_overwrite(self): df.plot(ax=ax1, kind="area") df.plot(ax=ax2, kind="area") - assert self.get_x_axis(ax1).joined(ax1, ax2) - assert self.get_x_axis(ax2).joined(ax1, ax2) + assert self.get_y_axis(ax1).joined(ax1, ax2) + assert self.get_y_axis(ax2).joined(ax1, ax2) def test_bar_linewidth(self): df = DataFrame(np.random.randn(5, 5)) From 82ab2dde54c61e02e1efa3556ae69c12b05a101e Mon Sep 17 00:00:00 2001 From: Thomas Li <47963215+lithomas1@users.noreply.github.com> Date: Thu, 18 Nov 2021 20:48:56 -0800 Subject: [PATCH 5/7] Update test_common.py --- pandas/tests/plotting/test_common.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pandas/tests/plotting/test_common.py b/pandas/tests/plotting/test_common.py index 4674fc1bb2c18..6eebf0c01ae52 100644 --- a/pandas/tests/plotting/test_common.py +++ b/pandas/tests/plotting/test_common.py @@ -39,4 +39,6 @@ def test__gen_two_subplots_with_ax(self): next(gen) axes = fig.get_axes() assert len(axes) == 1 - assert axes[0].get_geometry() == (2, 1, 2) + subplot_geometry = list(axes[0].get_subplotspec().get_geometry()[:-1]) + subplot_geometry[-1] += 1 + assert subplot_geometry == [2, 1, 2] From fa5f7aa3fd81597b0324e9e549665345c72a8675 Mon Sep 17 00:00:00 2001 From: Thomas Li <47963215+lithomas1@users.noreply.github.com> Date: Thu, 18 Nov 2021 21:07:26 -0800 Subject: [PATCH 6/7] Update converter.py --- pandas/plotting/_matplotlib/converter.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandas/plotting/_matplotlib/converter.py b/pandas/plotting/_matplotlib/converter.py index ead0a2129d29f..90d3f8d9836bf 100644 --- a/pandas/plotting/_matplotlib/converter.py +++ b/pandas/plotting/_matplotlib/converter.py @@ -357,8 +357,8 @@ def get_locator(self, dmin, dmax): locator = MilliSecondLocator(self.tz) locator.set_axis(self.axis) - locator.set_view_interval(*self.axis.get_view_interval()) - locator.set_data_interval(*self.axis.get_data_interval()) + locator.axis.set_view_interval(*self.axis.get_view_interval()) + locator.axis.set_data_interval(*self.axis.get_data_interval()) return locator return dates.AutoDateLocator.get_locator(self, dmin, dmax) From 0fcf4ab1e576d0f7c8551748c88b15284b4cb151 Mon Sep 17 00:00:00 2001 From: Thomas Li <47963215+lithomas1@users.noreply.github.com> Date: Fri, 19 Nov 2021 06:55:40 -0800 Subject: [PATCH 7/7] fix deprecation warnings? --- pandas/plotting/_matplotlib/core.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pandas/plotting/_matplotlib/core.py b/pandas/plotting/_matplotlib/core.py index ba47391513ed2..08dc9538227f7 100644 --- a/pandas/plotting/_matplotlib/core.py +++ b/pandas/plotting/_matplotlib/core.py @@ -1036,6 +1036,7 @@ def _plot_colorbar(self, ax: Axes, **kwds): # use the last one which contains the latest information # about the ax img = ax.collections[-1] + ax.grid(False) cbar = self.fig.colorbar(img, ax=ax, **kwds) if mpl_ge_3_0_0():