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 5851ac8

Browse filesBrowse files
authored
Merge pull request #14591 from anntzer/secondaryimports
Style fixes for secondary_axis.
2 parents 28fde25 + ec6fe36 commit 5851ac8
Copy full SHA for 5851ac8

File tree

Expand file treeCollapse file tree

1 file changed

+8
-32
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+8
-32
lines changed

‎lib/matplotlib/axes/_secondary_axes.py

Copy file name to clipboardExpand all lines: lib/matplotlib/axes/_secondary_axes.py
+8-32Lines changed: 8 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,11 @@
1-
import collections
21
import numpy as np
3-
import numbers
4-
5-
import warnings
62

3+
import matplotlib.cbook as cbook
74
import matplotlib.docstring as docstring
85
import matplotlib.ticker as mticker
96
import matplotlib.transforms as mtransforms
10-
import matplotlib.scale as mscale
11-
import matplotlib.cbook as cbook
12-
137
from matplotlib.axes._base import _AxesBase
148

15-
from matplotlib.ticker import (
16-
AutoLocator,
17-
AutoMinorLocator,
18-
FixedLocator,
19-
FuncFormatter,
20-
LogFormatterSciNotation,
21-
LogLocator,
22-
NullLocator,
23-
NullFormatter,
24-
ScalarFormatter
25-
)
26-
27-
from matplotlib.scale import Log10Transform
28-
299

3010
def _make_secondary_locator(rect, parent):
3111
"""
@@ -116,10 +96,9 @@ def set_alignment(self, align):
11696
11797
Parameters
11898
----------
119-
align :: string
99+
align : str
120100
either 'top' or 'bottom' for orientation='x' or
121-
'left' or 'right' for orientation='y' axis
122-
101+
'left' or 'right' for orientation='y' axis.
123102
"""
124103
if align in self._locstrings:
125104
if align == self._locstrings[1]:
@@ -178,6 +157,7 @@ def set_location(self, location):
178157
self.set_axes_locator(secondary_locator)
179158

180159
def apply_aspect(self, position=None):
160+
# docstring inherited.
181161
self._set_lims()
182162
super().apply_aspect(position)
183163

@@ -189,7 +169,6 @@ def set_ticks(self, ticks, minor=False):
189169
----------
190170
ticks : list
191171
List of x-axis tick locations.
192-
193172
minor : bool, optional
194173
If ``False`` sets major ticks, if ``True`` sets minor ticks.
195174
Default is ``False``.
@@ -215,7 +194,6 @@ def set_functions(self, functions):
215194
216195
If a transform is supplied, then the transform must have an
217196
inverse.
218-
219197
"""
220198

221199
if self._orientation == 'x':
@@ -254,9 +232,7 @@ def draw(self, renderer=None, inframe=False):
254232
using the converter specified by
255233
`~.axes._secondary_axes.set_functions` (or *functions*
256234
parameter when axes initialized.)
257-
258235
"""
259-
260236
self._set_lims()
261237
# this sets the scale in case the parent has set its scale.
262238
self._set_scale()
@@ -291,12 +267,12 @@ def _set_scale(self):
291267
# OK, set_scale sets the locators, but if we've called
292268
# axsecond.set_ticks, we want to keep those.
293269
if self._ticks_set:
294-
self._axis.set_major_locator(FixedLocator(ticks))
270+
self._axis.set_major_locator(mticker.FixedLocator(ticks))
295271

296272
def _set_lims(self):
297273
"""
298274
Set the limits based on parent limits and the convert method
299-
between the parent and this secondary axes
275+
between the parent and this secondary axes.
300276
"""
301277
if self._orientation == 'x':
302278
lims = self._parent.get_xlim()
@@ -371,12 +347,12 @@ def set_ylabel(self, ylabel, fontdict=None, labelpad=None, **kwargs):
371347

372348
def set_color(self, color):
373349
"""
374-
Change the color of the secondary axes and all decorators
350+
Change the color of the secondary axes and all decorators.
351+
375352
Parameters
376353
----------
377354
color : Matplotlib color
378355
"""
379-
380356
if self._orientation == 'x':
381357
self.tick_params(axis='x', colors=color)
382358
self.spines['bottom'].set_color(color)

0 commit comments

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