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

[WIP] axes_grid1: make twin* not modify host axes#13092

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
smheidrich wants to merge1 commit intomatplotlib:main
base:main
Choose a base branch
Loading
fromsmheidrich:twins_should_not_change_host
Draft
Show file tree
Hide file tree
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
13 changes: 13 additions & 0 deletionsdoc/api/next_api_changes/2019-01-04-SH.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
Changes to ``twin*`` methods in `mpl_toolkits.axes_grid1`
-----------------------------------------------------------

Previously, calling `~mpl_toolkits.axes_grid1.parasite_axes.HostAxesBase.twin`,
`~mpl_toolkits.axes_grid1.parasite_axes.HostAxesBase.twinx` or
`~mpl_toolkits.axes_grid1.parasite_axes.HostAxesBase.twiny` on
`mpl_toolkits.axes_grid1` host axes would hide the host axes' own axis
lines so that there is no overdrawing with the twin/parasite axes' axis lines.
This could lead to surprising behavior in certain cases
(`#10748 <https://github.com/matplotlib/matplotlib/issues/10748>`_), so the
logic has now been reversed, such that host axis lines are kept visible and
twin/parasite axis lines are hidden. This may break code which relies on the
specifics of host/parasite axis line visibility.
18 changes: 6 additions & 12 deletionslib/mpl_toolkits/axes_grid1/parasite_axes.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -249,17 +249,15 @@ def twinx(self, axes_class=None):
self.parasites.append(ax2)
ax2._remove_method = self._remove_twinx

self.axis["right"].set_visible(False)

ax2.axis["right"].set_visible(True)
ax2.axis["right"].toggle(all=True)
ax2.axis["right"].line.set_visible(False)
ax2.axis["left", "top", "bottom"].set_visible(False)

return ax2

def _remove_twinx(self, ax):
self.parasites.remove(ax)
self.axis["right"].set_visible(True)
self.axis["right"].toggle(ticklabels=False, label=False)

def twiny(self, axes_class=None):
"""
Expand All@@ -278,17 +276,15 @@ def twiny(self, axes_class=None):
self.parasites.append(ax2)
ax2._remove_method = self._remove_twiny

self.axis["top"].set_visible(False)

ax2.axis["top"].set_visible(True)
ax2.axis["top"].toggle(all=True)
ax2.axis["top"].line.set_visible(False)
ax2.axis["left", "right", "bottom"].set_visible(False)

return ax2

def _remove_twiny(self, ax):
self.parasites.remove(ax)
self.axis["top"].set_visible(True)
self.axis["top"].toggle(ticklabels=False, label=False)

def twin(self, aux_trans=None, axes_class=None):
"""
Expand All@@ -313,15 +309,13 @@ def twin(self, aux_trans=None, axes_class=None):
self.parasites.append(ax2)
ax2._remove_method = self.parasites.remove

self.axis["top", "right"].set_visible(False)

ax2.axis["top", "right"].set_visible(True)
ax2.axis["top", "right"].toggle(all=True)
ax2.axis["top", "right"].line.set_visible(False)
ax2.axis["left", "bottom"].set_visible(False)

def _remove_method(h):
self.parasites.remove(h)
self.axis["top", "right"].set_visible(True)
self.axis["top", "right"].toggle(ticklabels=False, label=False)
ax2._remove_method = _remove_method

return ax2
Expand Down
View file
Open in desktop
Loading
Sorry, something went wrong.Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

[8]ページ先頭

©2009-2025 Movatter.jp