Skip to content

Commit ac42b94

Browse files
committed
Deprecate passing a string as *num* argument
1 parent 60b95ab commit ac42b94

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Deprecation in EngFormatter
2+
```````````````````````````
3+
4+
Passing a string as *num* argument when calling an instance of
5+
`matplotlib.ticker.EngFormatter` is deprecated and will be removed in 2.3.

lib/matplotlib/ticker.py

+6
Original file line numberDiff line numberDiff line change
@@ -1262,6 +1262,12 @@ def format_eng(self, num):
12621262
`num` may be a numeric value or a string that can be converted
12631263
to a numeric value with ``float(num)``.
12641264
"""
1265+
if isinstance(num, six.string_types):
1266+
warnings.warn(
1267+
"Passing a string as *num* argument is deprecated since"
1268+
"Matplotlib 2.1, and is expected to be removed in 2.3.",
1269+
mplDeprecation)
1270+
12651271
dnum = float(num)
12661272
sign = 1
12671273
fmt = "g" if self.places is None else ".{:d}f".format(self.places)

0 commit comments

Comments
 (0)