Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent cd2ac88 commit 7f1422cCopy full SHA for 7f1422c
1 file changed
lib/matplotlib/ticker.py
@@ -1285,16 +1285,16 @@ def format_eng(self, num):
1285
1286
mant = sign * dnum / (10 ** pow10)
1287
1288
- # TODO: shouldn't we raise a warning if self.places < 0?
1289
if self.places is None:
1290
- format_str = "%g{sep:s}%s".format(sep=self.sep)
+ fmt = "g"
1291
elif self.places == 0:
1292
- format_str = "%d{sep:s}%s".format(sep=self.sep)
1293
- elif self.places > 0:
1294
- format_str = "%.{p:d}f{sep:s}%s".format(p=self.places,
1295
- sep=self.sep)
+ fmt = "d"
+ else:
+ fmt = ".{}f".format(self.places)
+
+ formatted = "{mant:{fmt}}{sep}{prefix}".format(
1296
+ mant=mant, fmt=fmt, sep=self.sep, prefix=prefix)
1297
- formatted = format_str % (mant, prefix)
1298
1299
return formatted
1300
0 commit comments