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

Skip to content

Commit 696f0b1

Browse files
committed
ticker.EngFormatter: Add units to ticks as well
1 parent e717682 commit 696f0b1

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/matplotlib/ticker.py

Lines 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)