10000 Merge pull request #10033 from efiring/share_and_aspect · matplotlib/matplotlib@fde699c · GitHub
[go: up one dir, main page]

Skip to content

Commit fde699c

Browse files
authored
Merge pull request #10033 from efiring/share_and_aspect
Improve handling of shared axes with specified aspect ratio
2 parents 4e140c8 + 4d6448a commit fde699c

File tree

8 files changed

+1746
-1650
lines changed

8 files changed

+1746
-1650
lines changed

lib/matplotlib/axes/_base.py

Lines changed: 116 additions & 85 deletions
Large diffs are not rendered by default.

lib/matplotlib/axes/_subplots.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,16 +144,21 @@ def label_outer(self):
144144

145145
def _make_twin_axes(self, *kl, **kwargs):
146146
"""
147-
make a twinx axes of self. This is used for twinx and twiny.
147+
Make a twinx axes of self. This is used for twinx and twiny.
148148
"""
149149
from matplotlib.projections import process_projection_requirements
150+
if 'sharex' in kwargs and 'sharey' in kwargs:
151+
raise ValueError("Twinned Axes may share only one axis.")
150152
kl = (self.get_subplotspec(),) + kl
151153
projection_class, kwargs, key = process_projection_requirements(
152154
self.figure, *kl, **kwargs)
153155

154156
ax2 = subplot_class_factory(projection_class)(self.figure,
155157
*kl, **kwargs)
156158
self.figure.add_subplot(ax2)
159+
self.set_adjustable('datalim')
160+
ax2.set_adjustable('datalim')
161+
self._twinned_axes.join(self, ax2)
157162
return ax2
158163

159164
_subplot_classes = {}
Binary file not shown.
Loading

0 commit comments

Comments
 (0)
0