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

Skip to content

Commit 377facb

Browse files
leejjoonmdboom
authored andcommitted
SubplotBase._make_twin_axes always creates a new subplot instance. Fixes #1957.
1 parent 98e37e8 commit 377facb

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

lib/matplotlib/axes.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9062,7 +9062,14 @@ def _make_twin_axes(self, *kl, **kwargs):
90629062
"""
90639063
make a twinx axes of self. This is used for twinx and twiny.
90649064
"""
9065-
ax2 = self.figure.add_subplot(self.get_subplotspec(), *kl, **kwargs)
9065+
from matplotlib.projections import process_projection_requirements
9066+
kl = (self.get_subplotspec(),) + kl
9067+
projection_class, kwargs, key = process_projection_requirements(
9068+
self.figure, *kl, **kwargs)
9069+
9070+
ax2 = subplot_class_factory(projection_class)(self.figure,
9071+
*kl, **kwargs)
9072+
self.figure.add_subplot(ax2)
90669073
return ax2
90679074

90689075

0 commit comments

Comments
 (0)