Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Refactor axislines nth_coord#26066

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
oscargus wants to merge1 commit intomatplotlib:main
base:main
Choose a base branch
Loading
fromoscargus:axislines
Draft
Changes fromall 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
38 changes: 21 additions & 17 deletionslib/mpl_toolkits/axisartist/axislines.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -84,6 +84,9 @@ def get_tick_iterators(self, axes):
return iter_major, iter_minor
"""

def __init__(self, nth_coord):
self.set_nth_coord(nth_coord)

def update_lim(self, axes):
pass

Expand All@@ -108,6 +111,12 @@ def _to_xy(self, values, const):
else:
raise ValueError("Unexpected nth_coord")

def get_nth_coord(self):
return self.nth_coord

def set_nth_coord(self, nth_coord):
self.nth_coord = nth_coord


class _FixedAxisArtistHelperBase(_AxisArtistHelperBase):
"""Helper class for a fixed (in the axes coordinate) axis."""
Expand All@@ -118,23 +127,22 @@ class _FixedAxisArtistHelperBase(_AxisArtistHelperBase):

def __init__(self, loc, nth_coord=None):
"""``nth_coord = 0``: x-axis; ``nth_coord = 1``: y-axis."""
self.nth_coord = (
nth_coord if nth_coord is not None else
_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__()
super().__init__(nth_coord)
# axis line in transAxes
self._path = Path(self._to_xy((0, 1), const=self._pos))

def get_nth_coord(self):
return self.nth_coord
def set_nth_coord(self, nth_coord):
self.nth_coord = (
nth_coord if nth_coord is not None else
_api.check_getitem(
{"bottom": 0, "top": 0, "left": 1, "right": 1}, loc=self._loc))
if (nth_coord == 0 and self._loc not in ["left", "right"]
or nth_coord == 1 and self._loc not in ["bottom", "top"]):
_api.warn_deprecated(
"3.7", message=f"{self._loc=!r} is incompatible with "
"{nth_coord=}; support is deprecated since %(since)s")

# LINE

Expand DownExpand Up@@ -170,12 +178,8 @@ def get_tick_transform(self, axes):
class _FloatingAxisArtistHelperBase(_AxisArtistHelperBase):

def __init__(self, nth_coord, value):
self.nth_coord = nth_coord
self._value = value
super().__init__()

def get_nth_coord(self):
return self.nth_coord
super().__init__(nth_coord)

def get_line(self, axes):
raise RuntimeError(
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp