File tree 1 file changed +5
-12
lines changed
1 file changed +5
-12
lines changed Original file line number Diff line number Diff line change @@ -987,13 +987,7 @@ def set_locs(self, locs=None):
987
987
self ._sublabels = set (np .arange (1 , b + 1 ))
988
988
989
989
def _num_to_string (self , x , vmin , vmax ):
990
- if x > 10000 :
991
- s = '%1.0e' % x
992
- elif x < 1 :
993
- s = '%1.0e' % x
994
- else :
995
- s = self ._pprint_val (x , vmax - vmin )
996
- return s
990
+ return self ._pprint_val (x , vmax - vmin ) if 1 <= x <= 10000 else f"{ x :1.0e} "
997
991
998
992
def __call__ (self , x , pos = None ):
999
993
# docstring inherited
@@ -1053,15 +1047,14 @@ class LogFormatterExponent(LogFormatter):
1053
1047
"""
1054
1048
Format values for log axis using ``exponent = log_base(value)``.
1055
1049
"""
1050
+
1056
1051
def _num_to_string (self , x , vmin , vmax ):
1057
1052
fx = math .log (x ) / math .log (self ._base )
1058
- if abs (fx ) > 10000 :
1059
- s = '%1.0g' % fx
1060
- elif abs (fx ) < 1 :
1061
- s = '%1.0g' % fx
1062
- else :
1053
+ if 1 <= abs (fx ) <= 10000 :
1063
1054
fd = math .log (vmax - vmin ) / math .log (self ._base )
1064
1055
s = self ._pprint_val (fx , fd )
1056
+ else :
1057
+ s = f"{ fx :1.0g} "
1065
1058
return s
1066
1059
1067
1060
You can’t perform that action at this time.
0 commit comments