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

[WIP] axes_grid1: make twin* not modify host axes by smheidrich · Pull Request #13092 · matplotlib/matplotlib · GitHub

Repository navigation

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

Filter by extension

Filter by extension .png  (1) .py  (1) .rst  (1) All 3 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
13 changes: 13 additions & 0 deletions doc/api/next_api_changes/2019-01-04-SH.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,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 deletions lib/mpl_toolkits/axes_grid1/parasite_axes.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 @@ -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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Viewer requires iframe.

Back | FazBrowse Home | New Git URL