Skip to content

Deprecate AxisArtistHelpers with inconsistent loc/nth_coord. #24904

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 9, 2023
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
4 changes: 4 additions & 0 deletions doc/api/next_api_changes/deprecations/24904-AL.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Passing inconsistent ``loc`` and ``nth_coord`` to axisartist helpers
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Trying to construct for example a "top y-axis" or a "left x-axis" is now
deprecated.
13 changes: 9 additions & 4 deletions lib/mpl_toolkits/axisartist/axislines.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,17 @@ class Fixed(_Base):

def __init__(self, loc, nth_coord=None):
"""``nth_coord = 0``: x-axis; ``nth_coord = 1``: y-axis."""
_api.check_in_list(["left", "right", "bottom", "top"], loc=loc)
self._loc = loc
self._pos = {"bottom": 0, "top": 1, "left": 0, "right": 1}[loc]
self.nth_coord = (
nth_coord if nth_coord is not None else
{"bottom": 0, "top": 0, "left": 1, "right": 1}[loc])
_api.check_getitem(
{"bottom": 0, "top": 0, "left": 1, "right": 1}, loc=loc))
if (nth_coord == 0 and loc not in ["left", "right"]
or nth_coord == 1 and loc not in ["bottom", "top"]):
_api.warn_deprecated(
"3.7", message=f"{loc=!r} is incompatible with "
"{nth_coord=}; support is deprecated since %(since)s")
self._loc = loc
self._pos = {"bottom": 0, "top": 1, "left": 0, "right": 1}[loc]
super().__init__()
# axis line in transAxes
self._path = Path(self._to_xy((0, 1), const=self._pos))
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy