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

Skip to content

Commit 35b2a93

Browse files
committed
Cleanup twin axes docstrings.
(plus `*kl` -> `*args`.) The override in axes_grid1/axes_divider.py was removed in 15d9b8e.
1 parent 1549229 commit 35b2a93

2 files changed

Lines changed: 13 additions & 19 deletions

File tree

lib/matplotlib/axes/_base.py

Lines 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

Lines 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)