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

Commit 7bc69f2

Browse filesBrowse files
authored
Merge pull request #24904 from anntzer/aaf
Deprecate AxisArtistHelpers with inconsistent loc/nth_coord.
2 parents ff17bc3 + bc15993 commit 7bc69f2
Copy full SHA for 7bc69f2

File tree

2 files changed

+13
-4
lines changed
Filter options

2 files changed

+13
-4
lines changed
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Passing inconsistent ``loc`` and ``nth_coord`` to axisartist helpers
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
Trying to construct for example a "top y-axis" or a "left x-axis" is now
4+
deprecated.

‎lib/mpl_toolkits/axisartist/axislines.py

Copy file name to clipboardExpand all lines: lib/mpl_toolkits/axisartist/axislines.py
+9-4Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,12 +126,17 @@ class Fixed(_Base):
126126

127127
def __init__(self, loc, nth_coord=None):
128128
"""``nth_coord = 0``: x-axis; ``nth_coord = 1``: y-axis."""
129-
_api.check_in_list(["left", "right", "bottom", "top"], loc=loc)
130-
self._loc = loc
131-
self._pos = {"bottom": 0, "top": 1, "left": 0, "right": 1}[loc]
132129
self.nth_coord = (
133130
nth_coord if nth_coord is not None else
134-
{"bottom": 0, "top": 0, "left": 1, "right": 1}[loc])
131+
_api.check_getitem(
132+
{"bottom": 0, "top": 0, "left": 1, "right": 1}, loc=loc))
133+
if (nth_coord == 0 and loc not in ["left", "right"]
134+
or nth_coord == 1 and loc not in ["bottom", "top"]):
135+
_api.warn_deprecated(
136+
"3.7", message=f"{loc=!r} is incompatible with "
137+
"{nth_coord=}; support is deprecated since %(since)s")
138+
self._loc = loc
139+
self._pos = {"bottom": 0, "top": 1, "left": 0, "right": 1}[loc]
135140
super().__init__()
136141
# axis line in transAxes
137142
self._path = Path(self._to_xy((0, 1), const=self._pos))

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.