10000 Use abs() instead of explicitly checking positive and negative value · matplotlib/matplotlib@e3ba6ba · GitHub
[go: up one dir, main page]

Skip to content

Commit e3ba6ba

Browse files
authored
Use abs() instead of explicitly checking positive and negative value
1 parent 300eefe commit e3ba6ba

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

lib/matplotlib/ticker.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1268,9 +1268,8 @@ def format_eng(self, num):
12681268
# Taking care of the cases like 999.9..., which may be rounded to 1000
12691269
# instead of 1 k. Beware of the corner case of values that are beyond
12701270
# the range of SI prefixes (i.e. > 'Y').
1271-
_fmant = float(format(mant, fmt))
1272-
if ((_fmant >= 1000 or _fmant <= -1000)
1273-
and pow10 < max(self.ENG_PREFIXES)):
1271+
if (abs(float(format(mant, fmt))) >= 1000
1272+
and pow10 < max(self.ENG_PREFIXES)):
12741273
mant /= 1000
12751274
pow10 += 3
12761275

0 commit comments

Comments
 (0)
0