Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 91244ce

Browse files
authored
Merge pull request #10900 from anntzer/30removals
Remove some APIs deprecated in mpl2.1.
2 parents f6ff0a4 + d42472a commit 91244ce

File tree

3 files changed

+15
-34
lines changed

3 files changed

+15
-34
lines changed

doc/api/next_api_changes/2018-02-26-AL-removals.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,12 @@ The following deprecated API elements have been removed:
2626
- ``_AxesBase.axesPatch``, ``_AxesBase.get_cursor_props``,
2727
``_AxesBase.set_cursor_props``,
2828
- ``_ImageBase.iterpnames``,
29+
- ``FigureCanvasBase.start_event_loop_default``;
30+
- ``FigureCanvasBase.stop_event_loop_default``;
2931
- ``Figure.figurePatch``,
3032
- ``FigureCanvasBase.dynamic_update``, ``FigureCanvasBase.idle_event``,
3133
``FigureCanvasBase.get_linestyle``, ``FigureCanvasBase.set_linestyle``,
3234
- ``FigureCanvasQTAgg.blitbox``,
35+
- passing non-numbers to ``EngFormatter.format_eng``,
3336
- passing ``frac`` to ``PolarAxes.set_theta_grids``,
37+
- any mention of idle events,

lib/matplotlib/backend_bases.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2337,13 +2337,7 @@ def on_press(event):
23372337
print('you pressed', event.button, event.xdata, event.ydata)
23382338
23392339
cid = canvas.mpl_connect('button_press_event', on_press)
2340-
23412340
"""
2342-
if s == 'idle_event':
2343-
cbook.warn_deprecated(1.5,
2344-
"idle_event is only implemented for the wx backend, and will "
2345-
"be removed in matplotlib 2.1. Use the animations module "
2346-
"instead.")
23472341

23482342
return self.callbacks.connect(s, func)
23492343

@@ -2428,11 +2422,6 @@ def stop_event_loop(self):
24282422
"""
24292423
self._looping = False
24302424

2431-
start_event_loop_default = cbook.deprecated(
2432-
"2.1", name="start_event_loop_default")(start_event_loop)
2433-
stop_event_loop_default = cbook.deprecated(
2434-
"2.1", name="stop_event_loop_default")(stop_event_loop)
2435-
24362425

24372426
def key_press_handler(event, canvas, toolbar=None):
24382427
"""

lib/matplotlib/ticker.py

Lines changed: 11 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1253,43 +1253,31 @@ def format_eng(self, num):
12531253
'1.0 M'
12541254
12551255
>>> format_eng("-1e-6") # for self.places = 2
1256-
u'-1.00 \N{GREEK SMALL LETTER MU}'
1257-
1258-
`num` may be a numeric value or a string that can be converted
1259-
to a numeric value with ``float(num)``.
1256+
'-1.00 \N{GREEK SMALL LETTER MU}'
12601257
"""
1261-
if isinstance(num, six.string_types):
1262-
warnings.warn(
1263-
"Passing a string as *num* argument is deprecated since"
1264-
"Matplotlib 2.1, and is expected to be removed in 2.3.",
1265-
mplDeprecation)
1266-
1267-
dnum = float(num)
12681258
sign = 1
12691259
fmt = "g" if self.places is None else ".{:d}f".format(self.places)
12701260

1271-
if dnum < 0:
1261+
if num < 0:
12721262
sign = -1
1273-
dnum = -dnum
1263+
num = -num
12741264

1275-
if dnum != 0:
1276-
pow10 = int(math.floor(math.log10(dnum) / 3) * 3)
1265+
if num != 0:
1266+
pow10 = int(math.floor(math.log10(num) / 3) * 3)
12771267
else:
12781268
pow10 = 0
1279-
# Force dnum to zero, to avoid inconsistencies like
1269+
# Force num to zero, to avoid inconsistencies like
12801270
# format_eng(-0) = "0" and format_eng(0.0) = "0"
12811271
# but format_eng(-0.0) = "-0.0"
1282-
dnum = 0.0
1272+
num = 0.0
12831273

12841274
pow10 = np.clip(pow10, min(self.ENG_PREFIXES), max(self.ENG_PREFIXES))
12851275

1286-
mant = sign * dnum / (10.0 ** pow10)
1287-
# Taking care of the cases like 999.9..., which
1288-
# may be rounded to 1000 instead of 1 k. Beware
1289-
# of the corner case of values that are beyond
1276+
mant = sign * num / (10.0 ** pow10)
1277+
# Taking care of the cases like 999.9..., which may be rounded to 1000
1278+
# instead of 1 k. Beware of the corner case of values that are beyond
12901279
# the range of SI prefixes (i.e. > 'Y').
1291-
_fmant = float("{mant:{fmt}}".format(mant=mant, fmt=fmt))
1292-
if _fmant >= 1000 and pow10 != max(self.ENG_PREFIXES):
1280+
if float(format(mant, fmt)) >= 1000 and pow10 < max(self.ENG_PREFIXES):
12931281
mant /= 1000
12941282
pow10 += 3
12951283

0 commit comments

Comments
 (0)