File tree Expand file tree Collapse file tree 1 file changed +5
-12
lines changed Expand file tree Collapse file tree 1 file changed +5
-12
lines changed Original file line number Diff line number Diff line change @@ -1001,13 +1001,7 @@ def set_locs(self, locs=None):
10011001 self ._sublabels = set (np .arange (1 , b + 1 ))
10021002
10031003 def _num_to_string (self , x , vmin , vmax ):
1004- if x > 10000 :
1005- s = '%1.0e' % x
1006- elif x < 1 :
1007- s = '%1.0e' % x
1008- else :
1009- s = self ._pprint_val (x , vmax - vmin )
1010- return s
1004+ return self ._pprint_val (x , vmax - vmin ) if 1 <= x <= 10000 else f"{ x :1.0e} "
10111005
10121006 def __call__ (self , x , pos = None ):
10131007 # docstring inherited
@@ -1067,15 +1061,14 @@ class LogFormatterExponent(LogFormatter):
10671061 """
10681062 Format values for log axis using ``exponent = log_base(value)``.
10691063 """
1064+
10701065 def _num_to_string (self , x , vmin , vmax ):
10711066 fx = math .log (x ) / math .log (self ._base )
1072- if abs (fx ) > 10000 :
1073- s = '%1.0g' % fx
1074- elif abs (fx ) < 1 :
1075- s = '%1.0g' % fx
1076- else :
1067+ if 1 <= abs (fx ) <= 10000 :
10771068 fd = math .log (vmax - vmin ) / math .log (self ._base )
10781069 s = self ._pprint_val (fx , fd )
1070+ else :
1071+ s = f"{ fx :1.0g} "
10791072 return s
10801073
10811074
You can’t perform that action at this time.
0 commit comments