Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d731d48

Browse files
authored
Merge pull request #25087 from MichaDit/feat/add-new-si-prefixes
feat: add new SI prefixes to ticker
2 parents 5619747 + 107fa52 commit d731d48

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

lib/matplotlib/tests/test_ticker.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1290,8 +1290,8 @@ class TestEngFormatter:
12901290
(True, 1001, ('1.001 k', '1 k', '1.00 k')),
12911291
(True, 100001, ('100.001 k', '100 k', '100.00 k')),
12921292
(True, 987654.321, ('987.654 k', '988 k', '987.65 k')),
1293-
# OoR value (> 1000 Y)
1294-
(True, 1.23e27, ('1230 Y', '1230 Y', '1230.00 Y'))
1293+
# OoR value (> 1000 Q)
1294+
(True, 1.23e33, ('1230 Q', '1230 Q', '1230.00 Q'))
12951295
]
12961296

12971297
@pytest.mark.parametrize('unicode_minus, input, expected', raw_format_data)

lib/matplotlib/ticker.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1330,6 +1330,8 @@ class EngFormatter(Formatter):
13301330

13311331
# The SI engineering prefixes
13321332
ENG_PREFIXES = {
1333+
-30: "q",
1334+
-27: "r",
13331335
-24: "y",
13341336
-21: "z",
13351337
-18: "a",
@@ -1346,7 +1348,9 @@ class EngFormatter(Formatter):
13461348
15: "P",
13471349
18: "E",
13481350
21: "Z",
1349-
24: "Y"
1351+
24: "Y",
1352+
27: "R",
1353+
30: "Q"
13501354
}
13511355

13521356
def __init__(self, unit="", places=None, sep=" ", *, usetex=None,

0 commit comments

Comments
 (0)