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

MNT: Turn Axes._axis_map into a static dict instead of a property #29424

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions 9 lib/matplotlib/axes/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -565,12 +565,6 @@ class _AxesBase(martist.Artist):
dataLim: mtransforms.Bbox
"""The bounding `.Bbox` enclosing all data displayed in the Axes."""

@property
def _axis_map(self):
"""A mapping of axis names, e.g. 'x', to `Axis` instances."""
return {name: getattr(self, f"{name}axis")
for name in self._axis_names}

def __str__(self):
return "{0}({1[0]:g},{1[1]:g};{1[2]:g}x{1[3]:g})".format(
type(self).__name__, self._position.bounds)
Expand Down Expand Up @@ -685,6 +679,9 @@ def __init__(self, fig,

# this call may differ for non-sep axes, e.g., polar
self._init_axis()
self._axis_map = {
name: getattr(self, f"{name}axis") for name in self._axis_names
} # A mapping of axis names, e.g. 'x', to `Axis` instances.
self._facecolor = mpl._val_or_rc(facecolor, 'axes.facecolor')
self._frameon = frameon
self.set_axisbelow(mpl.rcParams['axes.axisbelow'])
Expand Down
3 changes: 2 additions & 1 deletion 3 lib/matplotlib/axes/_base.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ from collections.abc import Callable, Iterable, Iterator, Sequence
from matplotlib import cbook
from matplotlib.artist import Artist
from matplotlib.axes import Axes
from matplotlib.axis import XAxis, YAxis, Tick
from matplotlib.axis import Axis, XAxis, YAxis, Tick
from matplotlib.backend_bases import RendererBase, MouseButton, MouseEvent
from matplotlib.cbook import CallbackRegistry
from matplotlib.container import Container
Expand Down Expand Up @@ -62,6 +62,7 @@ class _AxesBase(martist.Artist):
child_axes: list[_AxesBase]
legend_: Legend | None
title: Text
_axis_map: dict[str, Axis]
_projection_init: Any

def __init__(
Expand Down
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.