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

Appearance settings

Commit 4d6448a

Browse filesBrowse files
committed
Clarify axis sharing with aspect ratio control
- Axis sharing works across figures. - The "box-forced" adjustable is no longer needed. - Sharing both axes requires the use of "box", not "datalim". - A new "share" kwarg triggers synchronized setting of aspect ratio and adjustable in Axes within shared axis groups. - Added a test for axis sharing with aspect ratio setting. - Fixed and updated skew_rects test.
1 parent 4e140c8 commit 4d6448a
Copy full SHA for 4d6448a

File tree

Expand file treeCollapse file tree

8 files changed

+1746
-1650
lines changed
Filter options
Expand file treeCollapse file tree

8 files changed

+1746
-1650
lines changed

‎lib/matplotlib/axes/_base.py

Copy file name to clipboardExpand all lines: lib/matplotlib/axes/_base.py
+116-85Lines changed: 116 additions & 85 deletions
Large diffs are not rendered by default.

‎lib/matplotlib/axes/_subplots.py

Copy file name to clipboardExpand all lines: lib/matplotlib/axes/_subplots.py
+6-1Lines 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)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.