Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9a3144a

Browse files
committed
overloaded _make_twin_axes on LocateableAxesBase so that twinx and
twiny will work.
1 parent 65ce30e commit 9a3144a

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

lib/mpl_toolkits/axes_grid1/axes_divider.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -896,6 +896,15 @@ def draw(self, renderer=None, inframe=False):
896896

897897
self._axes_class.draw(self, renderer, inframe)
898898

899+
def _make_twin_axes(self, *kl, **kwargs):
900+
"""
901+
Need to overload so that twinx/twiny will work with
902+
these axes.
903+
"""
904+
ax2 = type(self)(self.figure, self.get_position(True), *kl, **kwargs)
905+
ax2.set_axes_locator(self.get_axes_locator())
906+
self.figure.add_axes(ax2)
907+
return ax2
899908

900909

901910
_locatableaxes_classes = {}

0 commit comments

Comments
 (0)