FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Deprecate AxisArtistHelpers with inconsistent loc/nth_coord. by anntzer · Pull Request #24904 · matplotlib/matplotlib · GitHub

Repository navigation

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (1) .rst  (1) All 2 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
4 changes: 4 additions & 0 deletions doc/api/next_api_changes/deprecations/24904-AL.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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

Back | FazBrowse Home | New Git URL