8000 Simplify and move cleaning strip op. from 'format_eng' to '__call__' · matplotlib/matplotlib@2193c79 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2193c79

Browse files
committed
Simplify and move cleaning strip op. from 'format_eng' to '__call__'
1 parent 8d086e0 commit 2193c79

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

lib/matplotlib/ticker.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1086,6 +1086,7 @@ def __init__(self, unit="", places=None, space_sep=True):
10861086

10871087
def __call__(self, x, pos=None):
10881088
s = "%s%s" % (self.format_eng(x), self.unit)
1089+
s = s.strip() # Remove separator when there is neither prefix nor unit
10891090
return self.fix_minus(s)
10901091

10911092
def format_eng(self, num):
@@ -1141,10 +1142,6 @@ def format_eng(self, num):
11411142

11421143
formatted = format_str % (mant, prefix)
11431144

1144-
formatted = formatted.strip()
1145-
if (self.unit != "") and (prefix == self.ENG_PREFIXES[0]):
1146-
formatted = formatted + self.sep
1147-
11481145
return formatted
11491146

11501147

0 commit comments

Comments
 (0)
0