Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit fd2a85a

Browse filesBrowse files
Backport PR #40718: COMPAT: matplotlib 3.4.0 (#40739)
Co-authored-by: jbrockmendel <jbrockmendel@gmail.com>
1 parent 114e0d9 commit fd2a85a
Copy full SHA for fd2a85a

File tree

Expand file treeCollapse file tree

3 files changed

+14
-5
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+14
-5
lines changed

‎pandas/plotting/_matplotlib/compat.py

Copy file name to clipboardExpand all lines: pandas/plotting/_matplotlib/compat.py
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,4 @@ def inner():
2222
mpl_ge_3_1_0 = _mpl_version("3.1.0", operator.ge)
2323
mpl_ge_3_2_0 = _mpl_version("3.2.0", operator.ge)
2424
mpl_ge_3_3_0 = _mpl_version("3.3.0", operator.ge)
25+
mpl_ge_3_4_0 = _mpl_version("3.4.0", operator.ge)

‎pandas/plotting/_matplotlib/tools.py

Copy file name to clipboardExpand all lines: pandas/plotting/_matplotlib/tools.py
+6-1Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,11 @@ def handle_shared_axes(
366366
row_num = lambda x: x.rowNum
367367
col_num = lambda x: x.colNum
368368

369+
if compat.mpl_ge_3_4_0():
370+
is_first_col = lambda x: x.get_subplotspec().is_first_col()
371+
else:
372+
is_first_col = lambda x: x.is_first_col()
373+
369374
if nrows > 1:
370375
try:
371376
# first find out the ax layout,
@@ -397,7 +402,7 @@ def handle_shared_axes(
397402
# only the first column should get y labels -> set all other to
398403
# off as we only have labels in the first column and we always
399404
# have a subplot there, we can skip the layout test
400-
if ax.is_first_col():
405+
if is_first_col(ax):
401406
continue
402407
if sharey or _has_externally_shared_axis(ax, "y"):
403408
_remove_labels_from_axis(ax.yaxis)

‎pandas/tests/plotting/frame/test_frame.py

Copy file name to clipboardExpand all lines: pandas/tests/plotting/frame/test_frame.py
+7-4Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -697,7 +697,9 @@ def test_plot_scatter_with_categorical_data(self, x, y):
697697

698698
_check_plot_works(df.plot.scatter, x=x, y=y)
699699

700-
def test_plot_scatter_with_c(self):
700+
def test_plot_scatter_with_c(self, request):
701+
from pandas.plotting._matplotlib.compat import mpl_ge_3_4_0
702+
701703
df = DataFrame(
702704
np.random.randn(6, 4),
703705
index=list(string.ascii_letters[:6]),
@@ -709,9 +711,10 @@ def test_plot_scatter_with_c(self):
709711
# default to Greys
710712
assert ax.collections[0].cmap.name == "Greys"
711713

712-
# n.b. there appears to be no public method
713-
# to get the colorbar label
714-
assert ax.collections[0].colorbar._label == "z"
714+
if mpl_ge_3_4_0():
715+
assert ax.collections[0].colorbar.ax.get_ylabel() == "z"
716+
else:
717+
assert ax.collections[0].colorbar._label == "z"
715718

716719
cm = "cubehelix"
717720
ax = df.plot.scatter(x="x", y="y", c="z", colormap=cm)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.