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

Skip to content

Commit 5619747

Browse files
authored
Merge pull request #24994 from oscargus/axismap
Use `_axis_map` instead of `getattr` in `Axes` and `Figure`
2 parents 0e7f6c1 + fd2b4b5 commit 5619747

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3670,7 +3670,7 @@ def apply_mask(arrays, mask):
36703670
continue
36713671
hlmarker = (
36723672
himarker
3673-
if getattr(self, f"{dep_axis}axis").get_inverted() ^ idx
3673+
if self._axis_map[dep_axis].get_inverted() ^ idx
36743674
else lomarker)
36753675
x_masked, y_masked, hl_masked = apply_mask(
36763676
[x, y, hl], lims & everymask)
@@ -4275,7 +4275,7 @@ def do_patch(xs, ys, **kwargs):
42754275
if manage_ticks:
42764276
axis_name = "x" if vert else "y"
42774277
interval = getattr(self.dataLim, f"interval{axis_name}")
4278-
axis = getattr(self, f"{axis_name}axis")
4278+
axis = self._axis_map[axis_name]
42794279
positions = axis.convert_units(positions)
42804280
# The 0.5 additional padding ensures reasonable-looking boxes
42814281
# even when drawing a single box. We set the sticky edge to

lib/matplotlib/figure.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -925,7 +925,7 @@ def _break_share_link(ax, grouper):
925925
for name in ax._axis_names:
926926
last_ax = _break_share_link(ax, ax._shared_axes[name])
927927
if last_ax is not None:
928-
_reset_locators_and_formatters(getattr(last_ax, f"{name}axis"))
928+
_reset_locators_and_formatters(last_ax._axis_map[name])
929929

930930
# Break link between any twinned axes
931931
_break_share_link(ax, ax._twinned_axes)

0 commit comments

Comments
 (0)