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 a25663a

Browse filesBrowse files
authored
Merge pull request #14737 from anntzer/twin
Cleanup twin axes docstrings.
2 parents 1549229 + 35b2a93 commit a25663a
Copy full SHA for a25663a

File tree

Expand file treeCollapse file tree

2 files changed

+13
-19
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+13
-19
lines changed

‎lib/matplotlib/axes/_base.py

Copy file name to clipboardExpand all lines: lib/matplotlib/axes/_base.py
+12-16Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4391,29 +4391,26 @@ def get_tightbbox(self, renderer, call_axes_locator=True,
43914391

43924392
return _bbox
43934393

4394-
def _make_twin_axes(self, *kl, **kwargs):
4395-
"""
4396-
Make a twinx axes of self. This is used for twinx and twiny.
4397-
"""
4394+
def _make_twin_axes(self, *args, **kwargs):
4395+
"""Make a twinx axes of self. This is used for twinx and twiny."""
43984396
# Typically, SubplotBase._make_twin_axes is called instead of this.
4399-
# There is also an override in axes_grid1/axes_divider.py.
44004397
if 'sharex' in kwargs and 'sharey' in kwargs:
4401-
raise ValueError("Twinned Axes may share only one axis.")
4402-
ax2 = self.figure.add_axes(self.get_position(True), *kl, **kwargs)
4398+
raise ValueError("Twinned Axes may share only one axis")
4399+
ax2 = self.figure.add_axes(self.get_position(True), *args, **kwargs)
44034400
self.set_adjustable('datalim')
44044401
ax2.set_adjustable('datalim')
44054402
self._twinned_axes.join(self, ax2)
44064403
return ax2
44074404

44084405
def twinx(self):
44094406
"""
4410-
Create a twin Axes sharing the xaxis
4407+
Create a twin Axes sharing the xaxis.
44114408
4412-
Create a new Axes instance with an invisible x-axis and an independent
4409+
Create a new Axes with an invisible x-axis and an independent
44134410
y-axis positioned opposite to the original one (i.e. at right). The
4414-
x-axis autoscale setting will be inherited from the original Axes.
4415-
To ensure that the tick marks of both y-axes align, see
4416-
`~matplotlib.ticker.LinearLocator`
4411+
x-axis autoscale setting will be inherited from the original
4412+
Axes. To ensure that the tick marks of both y-axes align, see
4413+
`~matplotlib.ticker.LinearLocator`.
44174414
44184415
Returns
44194416
-------
@@ -4437,13 +4434,13 @@ def twinx(self):
44374434

44384435
def twiny(self):
44394436
"""
4440-
Create a twin Axes sharing the yaxis
4437+
Create a twin Axes sharing the yaxis.
44414438
4442-
Create a new Axes instance with an invisible y-axis and an independent
4439+
Create a new Axes with an invisible y-axis and an independent
44434440
x-axis positioned opposite to the original one (i.e. at top). The
44444441
y-axis autoscale setting will be inherited from the original Axes.
44454442
To ensure that the tick marks of both x-axes align, see
4446-
`~matplotlib.ticker.LinearLocator`
4443+
`~matplotlib.ticker.LinearLocator`.
44474444
44484445
Returns
44494446
-------
@@ -4455,7 +4452,6 @@ def twiny(self):
44554452
For those who are 'picking' artists while using twiny, pick
44564453
events are only called for the artists in the top-most axes.
44574454
"""
4458-
44594455
ax2 = self._make_twin_axes(sharey=self)
44604456
ax2.xaxis.tick_top()
44614457
ax2.xaxis.set_label_position('top')

‎lib/matplotlib/axes/_subplots.py

Copy file name to clipboardExpand all lines: lib/matplotlib/axes/_subplots.py
+1-3Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,9 +163,7 @@ def label_outer(self):
163163
self.set_ylabel("")
164164

165165
def _make_twin_axes(self, *args, **kwargs):
166-
"""
167-
Make a twinx axes of self. This is used for twinx and twiny.
168-
"""
166+
"""Make a twinx axes of self. This is used for twinx and twiny."""
169167
if 'sharex' in kwargs and 'sharey' in kwargs:
170168
# The following line is added in v2.2 to avoid breaking Seaborn,
171169
# which currently uses this internal API.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.