From 456ae86be2d7508f168181014aa07e06aee013dc Mon Sep 17 00:00:00 2001 From: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> Date: Fri, 4 Aug 2023 15:09:34 +0200 Subject: [PATCH] Rename an internal parameter of _label_outer_x/yaxis() `check_patch` does not explain what this parameter is achieving. --- lib/matplotlib/axes/_base.py | 12 ++++++------ lib/matplotlib/gridspec.py | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/matplotlib/axes/_base.py b/lib/matplotlib/axes/_base.py index 9c2ba63901fd..13e8d435ef37 100644 --- a/lib/matplotlib/axes/_base.py +++ b/lib/matplotlib/axes/_base.py @@ -4498,12 +4498,12 @@ def label_outer(self): labels are on the top side); y-labels only for subplots on the first column (or last column, if labels are on the right side). """ - self._label_outer_xaxis(check_patch=False) - self._label_outer_yaxis(check_patch=False) + self._label_outer_xaxis(skip_non_rectangular_axes=False) + self._label_outer_yaxis(skip_non_rectangular_axes=False) - def _label_outer_xaxis(self, *, check_patch): + def _label_outer_xaxis(self, *, skip_non_rectangular_axes): # see documentation in label_outer. - if check_patch and not isinstance(self.patch, mpl.patches.Rectangle): + if skip_non_rectangular_axes and not isinstance(self.patch, mpl.patches.Rectangle): return ss = self.get_subplotspec() if not ss: @@ -4522,9 +4522,9 @@ def _label_outer_xaxis(self, *, check_patch): if self.xaxis.offsetText.get_position()[1] == 0: self.xaxis.offsetText.set_visible(False) - def _label_outer_yaxis(self, *, check_patch): + def _label_outer_yaxis(self, *, skip_non_rectangular_axes): # see documentation in label_outer. - if check_patch and not isinstance(self.patch, mpl.patches.Rectangle): + if skip_non_rectangular_axes and not isinstance(self.patch, mpl.patches.Rectangle): return ss = self.get_subplotspec() if not ss: diff --git a/lib/matplotlib/gridspec.py b/lib/matplotlib/gridspec.py index c86a527ef54a..b2f1b5d8ff2e 100644 --- a/lib/matplotlib/gridspec.py +++ b/lib/matplotlib/gridspec.py @@ -301,10 +301,10 @@ def subplots(self, *, sharex=False, sharey=False, squeeze=True, # turn off redundant tick labeling if sharex in ["col", "all"]: for ax in axarr.flat: - ax._label_outer_xaxis(check_patch=True) + ax._label_outer_xaxis(skip_non_rectangular_axes=True) if sharey in ["row", "all"]: for ax in axarr.flat: - ax._label_outer_yaxis(check_patch=True) + ax._label_outer_yaxis(skip_non_rectangular_axes=True) if squeeze: # Discarding unneeded dimensions that equal 1. If we only have one