1
- import collections
2
1
import numpy as np
3
- import numbers
4
-
5
- import warnings
6
2
3
+ import matplotlib .cbook as cbook
7
4
import matplotlib .docstring as docstring
8
5
import matplotlib .ticker as mticker
9
6
import matplotlib .transforms as mtransforms
10
- import matplotlib .scale as mscale
11
- import matplotlib .cbook as cbook
12
-
13
7
from matplotlib .axes ._base import _AxesBase
14
8
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
-
29
9
30
10
def _make_secondary_locator (rect , parent ):
31
11
"""
@@ -116,10 +96,9 @@ def set_alignment(self, align):
116
96
117
97
Parameters
118
98
----------
119
- align :: string
99
+ align : str
120
100
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.
123
102
"""
124
103
if align in self ._locstrings :
125
104
if align == self ._locstrings [1 ]:
@@ -178,6 +157,7 @@ def set_location(self, location):
178
157
self .set_axes_locator (secondary_locator )
179
158
180
159
def apply_aspect (self , position = None ):
160
+ # docstring inherited.
181
161
self ._set_lims ()
182
162
super ().apply_aspect (position )
183
163
@@ -189,7 +169,6 @@ def set_ticks(self, ticks, minor=False):
189
169
----------
190
170
ticks : list
191
171
List of x-axis tick locations.
192
-
193
172
minor : bool, optional
194
173
If ``False`` sets major ticks, if ``True`` sets minor ticks.
195
174
Default is ``False``.
@@ -215,7 +194,6 @@ def set_functions(self, functions):
215
194
216
195
If a transform is supplied, then the transform must have an
217
196
inverse.
218
-
219
197
"""
220
198
221
199
if self ._orientation == 'x' :
@@ -254,9 +232,7 @@ def draw(self, renderer=None, inframe=False):
254
232
using the converter specified by
255
233
`~.axes._secondary_axes.set_functions` (or *functions*
256
234
parameter when axes initialized.)
257
-
258
235
"""
259
-
260
236
self ._set_lims ()
261
237
# this sets the scale in case the parent has set its scale.
262
238
self ._set_scale ()
@@ -291,12 +267,12 @@ def _set_scale(self):
291
267
# OK, set_scale sets the locators, but if we've called
292
268
# axsecond.set_ticks, we want to keep those.
293
269
if self ._ticks_set :
294
- self ._axis .set_major_locator (FixedLocator (ticks ))
270
+ self ._axis .set_major_locator (mticker . FixedLocator (ticks ))
295
271
296
272
def _set_lims (self ):
297
273
"""
298
274
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.
300
276
"""
301
277
if self ._orientation == 'x' :
302
278
lims = self ._parent .get_xlim ()
@@ -371,12 +347,12 @@ def set_ylabel(self, ylabel, fontdict=None, labelpad=None, **kwargs):
371
347
372
348
def set_color (self , color ):
373
349
"""
374
- Change the color of the secondary axes and all decorators
350
+ Change the color of the secondary axes and all decorators.
351
+
375
352
Parameters
376
353
----------
377
354
color : Matplotlib color
378
355
"""
379
-
380
356
if self ._orientation == 'x' :
381
357
self .tick_params (axis = 'x' , colors = color )
382
358
self .spines ['bottom' ].set_color (color )
0 commit comments