4
4
from numpy import ma
5
5
6
6
from matplotlib .cbook import dedent
7
- from matplotlib .ticker import (NullFormatter , ScalarFormatter ,
7
+ from matplotlib .ticker import (NullFormatter , ScalarFormatter ,
8
8
LogFormatterMathtext )
9
- from matplotlib .ticker import (NullLocator , LogLocator , AutoLocator ,
9
+ from matplotlib .ticker import (NullLocator , LogLocator , AutoLocator ,
10
10
SymmetricalLogLocator )
11
11
from matplotlib .transforms import Transform , IdentityTransform
12
12
from matplotlib import docstring
@@ -120,7 +120,7 @@ class LogTransformBase(Transform):
120
120
output_dims = 1
121
121
is_separable = True
122
122
has_inverse = True
123
-
123
+
124
124
def __init__ (self , nonpos ):
125
125
Transform .__init__ (self )
126
126
if nonpos == 'mask' :
@@ -208,7 +208,7 @@ class LogTransform(Transform):
208
208
output_dims = 1
209
209
is_separable = True
210
210
has_inverse = True
211
-
211
+
212
212
def __init__ (self , base , nonpos ):
213
213
Transform .__init__ (self )
214
214
self .base = base
@@ -231,7 +231,7 @@ class InvertedLogTransform(Transform):
231
231
output_dims = 1
232
232
is_separable = True
233
233
has_inverse = True
234
-
234
+
235
235
def __init__ (self , base ):
236
236
Transform .__init__ (self )
237
237
self .base = base
@@ -241,7 +241,7 @@ def transform_non_affine(self, a):
241
241
242
242
def inverted (self ):
243
243
return LogScale .LogTransform (self .base )
244
-
244
+
245
245
def __init__ (self , axis , ** kwargs ):
246
246
"""
247
247
*basex*/*basey*:
@@ -325,7 +325,7 @@ class SymmetricalLogTransform(Transform):
325
325
output_dims = 1
326
326
is_separable = True
327
327
has_inverse = True
328
-
328
+
329
329
def __init__ (self , base , linthresh , linscale ):
330
330
Transform .__init__ (self )
331
331
self .base = base
@@ -336,7 +336,10 @@ def __init__(self, base, linthresh, linscale):
336
336
337
337
def transform_non_affine (self , a ):
338
338
sign = np .sign (a )
339
- masked = ma .masked_inside (a , - self .linthresh , self .linthresh , copy = False )
339
+ masked = ma .masked_inside (a ,
340
+ - self .linthresh ,
341
+ self .linthresh ,
342
+ copy = False )
340
343
log = sign * self .linthresh * (
341
344
self ._linscale_adj +
342
345
ma .log (np .abs (masked ) / self .linthresh ) / self ._log_base )
@@ -354,10 +357,12 @@ class InvertedSymmetricalLogTransform(Transform):
354
357
output_dims = 1
355
358
is_separable = True
356
359
has_inverse = True
357
-
360
+
358
361
def __init__ (self , base , linthresh , linscale ):
359
362
Transform .__init__ (self )
360
- symlog = SymmetricalLogScale .SymmetricalLogTransform (base , linthresh , linscale )
363
+ symlog = SymmetricalLogScale .SymmetricalLogTransform (base ,
364
+ linthresh ,
365
+ linscale )
361
366
self .base = base
362
367
self .linthresh = linthresh
363
368
self .invlinthresh = symlog .transform (linthresh )
@@ -366,7 +371,8 @@ def __init__(self, base, linthresh, linscale):
366
371
367
372
def transform_non_affine (self , a ):
368
373
sign = np .sign (a )
369
- masked = ma .masked_inside (a , - self .invlinthresh , self .invlinthresh , copy = False )
374
+ masked = ma .masked_inside (a , - self .invlinthresh ,
375
+ self .invlinthresh , copy = False )
370
376
exp = sign * self .linthresh * (
371
377
ma .power (self .base , (sign * (masked / self .linthresh ))
372
378
- self ._linscale_adj ))
@@ -420,7 +426,9 @@ def __init__(self, axis, **kwargs):
420
426
assert linthresh > 0.0
421
427
assert linscale >= 1.0
422
428
423
- self ._transform = self .SymmetricalLogTransform (base , linthresh , linscale )
429
+ self ._transform = self .SymmetricalLogTransform (base ,
430
+ linthresh ,
431
+ linscale )
424
432
425
433
self .base = base
426
434
self .linthresh = linthresh
@@ -434,7 +442,8 @@ def set_default_locators_and_formatters(self, axis):
434
442
"""
435
443
axis .set_major_locator (SymmetricalLogLocator (self .get_transform ()))
436
444
axis .set_major_formatter (LogFormatterMathtext (self .base ))
437
- axis .set_minor_locator (SymmetricalLogLocator (self .get_transform (), self .subs ))
445
+ axis .set_minor_locator (SymmetricalLogLocator (self .get_transform (),
446
+ self .subs ))
438
447
axis .set_minor_formatter (NullFormatter ())
439
448
440
449
def get_transform (self ):
@@ -445,9 +454,9 @@ def get_transform(self):
445
454
446
455
447
456
_scale_mapping = {
448
- 'linear' : LinearScale ,
449
- 'log' : LogScale ,
450
- 'symlog' : SymmetricalLogScale
457
+ 'linear' : LinearScale ,
458
+ 'log' : LogScale ,
459
+ 'symlog' : SymmetricalLogScale
451
460
}
452
461
453
462
@@ -502,6 +511,6 @@ def get_scale_docs():
502
511
503
512
504
513
docstring .interpd .update (
505
- scale = ' | ' .join ([repr (x ) for x in get_scale_names ()]),
506
- scale_docs = get_scale_docs ().strip (),
514
+ scale = ' | ' .join ([repr (x ) for x in get_scale_names ()]),
515
+ scale_docs = get_scale_docs ().strip (),
507
516
)
0 commit comments