@@ -428,22 +428,23 @@ class OldScalarFormatter(Formatter):
428
428
429
429
def __call__ (self , x , pos = None ):
430
430
"""
431
- Return the format for tick val `x` based on the width of the
432
- axis.
431
+ Return the format for tick val `x` based on the width of the axis.
433
432
434
433
The position `pos` is ignored.
435
434
"""
436
435
xmin , xmax = self .axis .get_view_interval ()
437
436
d = abs (xmax - xmin )
437
+ return self ._pprint_val (x , d )
438
438
439
- return self .pprint_val (x , d )
439
+ @cbook .deprecated ("3.1" )
440
+ def pprint_val (self , * args , ** kwargs ):
441
+ return self ._pprint_val (* args , ** kwargs )
440
442
441
- def pprint_val (self , x , d ):
443
+ def _pprint_val (self , x , d ):
442
444
"""
443
445
Formats the value `x` based on the size of the axis range `d`.
444
446
"""
445
- #if the number is not too big and it's an int, format it as an
446
- #int
447
+ # If the number is not too big and it's an int, format it as an int.
447
448
if abs (x ) < 1e4 and x == int (x ):
448
449
return '%d' % x
449
450
@@ -555,7 +556,7 @@ def __call__(self, x, pos=None):
555
556
if len (self .locs ) == 0 :
556
557
return ''
557
558
else :
558
- s = self .pprint_val (x )
559
+ s = self ._pprint_val (x )
559
560
return self .fix_minus (s )
560
561
561
562
def set_scientific (self , b ):
@@ -766,7 +767,11 @@ def _set_format(self, vmin, vmax):
766
767
elif self ._useMathText :
767
768
self .format = '$%s$' % _mathdefault (self .format )
768
769
769
- def pprint_val (self , x ):
770
+ @cbook .deprecated ("3.1" )
771
+ def pprint_val (self , * args , ** kwargs ):
772
+ return self ._pprint_val (* args , ** kwargs )
773
+
774
+ def _pprint_val (self , x ):
770
775
xp = (x - self .offset ) / (10. ** self .orderOfMagnitude )
771
776
if np .abs (xp ) < 1e-8 :
772
777
xp = 0
@@ -966,7 +971,7 @@ def _num_to_string(self, x, vmin, vmax):
966
971
elif x < 1 :
967
972
s = '%1.0e' % x
968
973
else :
969
- s = self .pprint_val (x , vmax - vmin )
974
+ s = self ._pprint_val (x , vmax - vmin )
970
975
return s
971
976
972
977
def __call__ (self , x , pos = None ):
@@ -1007,9 +1012,12 @@ def format_data_short(self, value):
1007
1012
"""
1008
1013
return '%-12g' % value
1009
1014
1010
- def pprint_val (self , x , d ):
1011
- #if the number is not too big and it's an int, format it as an
1012
- #int
1015
+ @cbook .deprecated ("3.1" )
1016
+ def pprint_val (self , * args , ** kwargs ):
1017
+ return self ._pprint_val (* args , ** kwargs )
1018
+
1019
+ def _pprint_val (self , x , d ):
1020
+ # If the number is not too big and it's an int, format it as an int.
1013
1021
if abs (x ) < 1e4 and x == int (x ):
1014
1022
return '%d' % x
1015
1023
@@ -1052,7 +1060,7 @@ def _num_to_string(self, x, vmin, vmax):
1052
1060
s = '%1.0g' % fx
1053
1061
else :
1054
1062
fd = math .log (vmax - vmin ) / math .log (self ._base )
1055
- s = self .pprint_val (fx , fd )
1063
+ s = self ._pprint_val (fx , fd )
1056
1064
return s
1057
1065
1058
1066
0 commit comments