Skip to content

Commit 9e77b05

Browse files
committed
Deprecate AxisArtistHelpers with inconsistent loc/nth_coord.
A "top y-axis" or a "left x-axis" doesn't make sense.
1 parent 8dd1058 commit 9e77b05

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed
Lines 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

Lines 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)
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