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

Skip to content

Commit 81a1d04

Browse files
committed
Simplify and move cleaning strip op. from 'format_eng' to '__call__'
1 parent 3de3589 commit 81a1d04

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

12431243
def __call__(self, x, pos=None):
12441244
s = "%s%s" % (self.format_eng(x), self.unit)
1245+
s = s.strip() # Remove separator when there is neither prefix nor unit
12451246
return self.fix_minus(s)
12461247

12471248
def format_eng(self, num):
@@ -1297,10 +1298,6 @@ def format_eng(self, num):
12971298

12981299
formatted = format_str % (mant, prefix)
12991300

1300-
formatted = formatted.strip()
1301-
if (self.unit != "") and (prefix == self.ENG_PREFIXES[0]):
1302-
formatted = formatted + self.sep
1303-
13041301
return formatted
13051302

13061303

0 commit comments

Comments
 (0)
0