19
19
NullLocator , LogLocator , AutoLocator , AutoMinorLocator ,
20
20
SymmetricalLogLocator , LogitLocator )
21
21
from matplotlib .transforms import Transform , IdentityTransform
22 + from matplotlib .cbook import warn_deprecated
22
23
23
24
24
25
class ScaleBase :
@@ -52,6 +53,14 @@ def __init__(self, axis, **kwargs):
52
53
be used: a single scale object should be usable by multiple
53
54
`~matplotlib.axis.Axis`\es at the same time.
54
55
"""
56
+ if kwargs :
57
+ warn_deprecated (
58
+ '3.2.0' ,
59
+ message = (
60
+ f"ScaleBase got an unexpected keyword "
61
+ f"argument { next (iter (kwargs ))!r} . "
62
+ 'In the future this will raise TypeError' )
63
+ )
55
64
56
65
def get_transform (self ):
57
66
"""
@@ -143,8 +152,7 @@ def forward(values: array-like) -> array-like
143
152
self ._forward = forward
144
153
self ._inverse = inverse
145
154
else :
146
- raise ValueError ('arguments to FuncTransform must '
147
- 'be functions' )
155
+ raise ValueError ('arguments to FuncTransform must be functions' )
148
156
149
157
def transform_non_affine (self , values ):
150
158
return self ._forward (values )
@@ -382,16 +390,14 @@ def __init__(self, axis, **kwargs):
382
390
nonpos = kwargs .pop ('nonposy' , 'clip' )
383
391
cbook ._check_in_list (['mask' , 'clip' ], nonposy = nonpos )
384
392
385
- if len (kwargs ):
386
- raise ValueError (("provided too many kwargs, can only pass "
387
- "{'basex', 'subsx', nonposx'} or "
388
- "{'basey', 'subsy', nonposy'}. You passed " ) +
389
- "{!r}" .format (kwargs ))
393
+ if kwargs :
394
+ raise TypeError (f"LogScale got an unexpected keyword "
395
+ f"argument { next (iter (kwargs ))!r} " )
390
396
391
397
if base <= 0 or base == 1 :
392
398
raise ValueError ('The log base cannot be <= 0 or == 1' )
393
399
394
- self ._transform = self . LogTransform (base , nonpos )
400
+ self ._transform = LogTransform (base , nonpos )
395
401
self .subs = subs
396
402
397
403
@property
@@ -566,6 +572,16 @@ def __init__(self, axis, **kwargs):
566
572
linthresh = kwargs .pop ('linthreshy' , 2.0 )
567
573
subs = kwargs .pop ('subsy' , None )
568
574
linscale = kwargs .pop ('linscaley' , 1.0 )
575
+ if kwargs :
576
+ warn_deprecated (
577
+ '3.2.0' ,
578
+ message = (
579
+ f"SymmetricalLogScale got an unexpected keyword "
580
+ f"argument { next (iter (kwargs ))!r} . "
581
+ 'In the future this will raise TypeError' )
582
+ )
583
+ # raise TypeError(f"SymmetricalLogScale got an unexpected keyword "
584
+ # f"argument {next(iter(kwargs))!r}")
569
585
570
586
if base <= 1.0 :
571
587
raise ValueError ("'basex/basey' must be larger than 1" )
@@ -574,10 +590,7 @@ def __init__(self, axis, **kwargs):
574
590
if linscale <= 0.0 :
575
591
raise ValueError ("'linscalex/linthreshy' must be positive" )
576
592
577
- self ._transform = self .SymmetricalLogTransform (base ,
578
- linthresh ,
579
- linscale )
580
-
593
+ self ._transform = SymmetricalLogTransform (base , linthresh , linscale )
581
594
self .base = base
582
595
self .linthresh = linthresh
583
596
self .linscale = linscale
0 commit comments