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 @@ -987,13 +987,7 @@ def set_locs(self, locs=None):
987987 self ._sublabels = set (np .arange (1 , b + 1 ))
988988
989989 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} "
997991
998992 def __call__ (self , x , pos = None ):
999993 # docstring inherited
@@ -1053,15 +1047,14 @@ class LogFormatterExponent(LogFormatter):
10531047 """
10541048 Format values for log axis using ``exponent = log_base(value)``.
10551049 """
1050+
10561051 def _num_to_string (self , x , vmin , vmax ):
10571052 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 :
10631054 fd = math .log (vmax - vmin ) / math .log (self ._base )
10641055 s = self ._pprint_val (fx , fd )
1056+ else :
1057+ s = f"{ fx :1.0g} "
10651058 return s
10661059
10671060
You can’t perform that action at this time.
0 commit comments