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

Skip to content

Commit 7bad242

Browse files
committed
Simplify and move cleaning strip op. from 'format_eng' to '__call__'
1 parent a1a38c5 commit 7bad242

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
@@ -1240,6 +1240,7 @@ def __init__(self, unit="", places=None, space_sep=True):
12401240

12411241
def __call__(self, x, pos=None):
12421242
s = "%s%s" % (self.format_eng(x), self.unit)
1243+
s = s.strip() # Remove separator when there is neither prefix nor unit
12431244
return self.fix_minus(s)
12441245

12451246
def format_eng(self, num):
@@ -1295,10 +1296,6 @@ def format_eng(self, num):
12951296

12961297
formatted = format_str % (mant, prefix)
12971298

1298-
formatted = formatted.strip()
1299-
if (self.unit != "") and (prefix == self.ENG_PREFIXES[0]):
1300-
formatted = formatted + self.sep
1301-
13021299
return formatted
13031300

13041301

0 commit comments

Comments
 (0)
0