Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5140177

Browse files
authored
Merge pull request #26454 from timhoffm/label_outer_check_rectilinear
Rename an internal parameter of _label_outer_x/yaxis()
2 parents 868004b + 88e1353 commit 5140177

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

lib/matplotlib/axes/_base.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4498,12 +4498,13 @@ def label_outer(self):
44984498
labels are on the top side); y-labels only for subplots on the first
44994499
column (or last column, if labels are on the right side).
45004500
"""
4501-
self._label_outer_xaxis(check_patch=False)
4502-
self._label_outer_yaxis(check_patch=False)
4501+
self._label_outer_xaxis(skip_non_rectangular_axes=False)
4502+
self._label_outer_yaxis(skip_non_rectangular_axes=False)
45034503

4504-
def _label_outer_xaxis(self, *, check_patch):
4504+
def _label_outer_xaxis(self, *, skip_non_rectangular_axes):
45054505
# see documentation in label_outer.
4506-
if check_patch and not isinstance(self.patch, mpl.patches.Rectangle):
4506+
if skip_non_rectangular_axes and not isinstance(self.patch,
4507+
mpl.patches.Rectangle):
45074508
return
45084509
ss = self.get_subplotspec()
45094510
if not ss:
@@ -4522,9 +4523,10 @@ def _label_outer_xaxis(self, *, check_patch):
45224523
if self.xaxis.offsetText.get_position()[1] == 0:
45234524
self.xaxis.offsetText.set_visible(False)
45244525

4525-
def _label_outer_yaxis(self, *, check_patch):
4526+
def _label_outer_yaxis(self, *, skip_non_rectangular_axes):
45264527
# see documentation in label_outer.
4527-
if check_patch and not isinstance(self.patch, mpl.patches.Rectangle):
4528+
if skip_non_rectangular_axes and not isinstance(self.patch,
4529+
mpl.patches.Rectangle):
45284530
return
45294531
ss = self.get_subplotspec()
45304532
if not ss:

lib/matplotlib/figure.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2118,10 +2118,10 @@ def _do_layout(gs, mosaic, unique_ids, nested):
21182118
for ax in ret.values():
21192119
if sharex:
21202120
ax.sharex(ax0)
2121-
ax._label_outer_xaxis(check_patch=True)
2121+
ax._label_outer_xaxis(skip_non_rectangular_axes=True)
21222122
if sharey:
21232123
ax.sharey(ax0)
2124-
ax._label_outer_yaxis(check_patch=True)
2124+
ax._label_outer_yaxis(skip_non_rectangular_axes=True)
21252125
if extra := set(per_subplot_kw) - set(ret):
21262126
raise ValueError(
21272127
f"The keys {extra} are in *per_subplot_kw* "

lib/matplotlib/gridspec.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,10 +301,10 @@ def subplots(self, *, sharex=False, sharey=False, squeeze=True,
301301
# turn off redundant tick labeling
302302
if sharex in ["col", "all"]:
303303
for ax in axarr.flat:
304-
ax._label_outer_xaxis(check_patch=True)
304+
ax._label_outer_xaxis(skip_non_rectangular_axes=True)
305305
if sharey in ["row", "all"]:
306306
for ax in axarr.flat:
307-
ax._label_outer_yaxis(check_patch=True)
307+
ax._label_outer_yaxis(skip_non_rectangular_axes=True)
308308

309309
if squeeze:
310310
# Discarding unneeded dimensions that equal 1. If we only have one

0 commit comments

Comments
 (0)