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

Appearance settings

Commit 696f0b1

Browse filesBrowse files
committed
ticker.EngFormatter: Add units to ticks as well
1 parent e717682 commit 696f0b1
Copy full SHA for 696f0b1

File tree

1 file changed

+5
-1
lines changed
Filter options

1 file changed

+5
-1
lines changed

‎lib/matplotlib/ticker.py

Copy file name to clipboardExpand all lines: lib/matplotlib/ticker.py
+5-1Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1435,7 +1435,11 @@ def __call__(self, x, pos=None):
14351435
xp = (x - self.offset) / (10. ** self.orderOfMagnitude)
14361436
if abs(xp) < 1e-8:
14371437
xp = 0
1438-
return self._format_maybe_minus_and_locale(self.format, xp)
1438+
# The ScalarFormatter.__call__ reads the locale here as well. We
1439+
# don't care about it, and we want the ticks to also get the unit
1440+
# with the best prefix as computed by self.format_data that is
1441+
# produced by it doesn't
1442+
return self.fix_minus(self.format_data(xp))
14391443

14401444
def set_locs(self, locs):
14411445
# docstring inherited

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.