Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0f37c41

Browse files
committed
FIX: force format_eng(-0.0) to be consistent with format_eng(0)
1 parent99b590c commit0f37c41

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

‎lib/matplotlib/ticker.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1117,6 +1117,10 @@ def format_eng(self, num):
11171117
pow10=decimal.Decimal(int(math.floor(dnum.log10()/3)*3))
11181118
else:
11191119
pow10=decimal.Decimal(0)
1120+
# Force dnum to zero, to avoid inconsistencies like
1121+
# format_eng(-0) = "0" and format_eng(0.0) = "0"
1122+
# but format_eng(-0.0) = "-0.0"
1123+
dnum=decimal.Decimal(0)
11201124

11211125
pow10=pow10.min(max(self.ENG_PREFIXES.keys()))
11221126
pow10=pow10.max(min(self.ENG_PREFIXES.keys()))

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp