Skip to content

Remove some APIs deprecated in mpl2.1. #10900

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 28, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions doc/api/next_api_changes/2018-02-26-AL-removals.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,12 @@ The following deprecated API elements have been removed:
- ``_AxesBase.axesPatch``, ``_AxesBase.get_cursor_props``,
``_AxesBase.set_cursor_props``,
- ``_ImageBase.iterpnames``,
- ``FigureCanvasBase.start_event_loop_default``;
- ``FigureCanvasBase.stop_event_loop_default``;
- ``Figure.figurePatch``,
- ``FigureCanvasBase.dynamic_update``, ``FigureCanvasBase.idle_event``,
``FigureCanvasBase.get_linestyle``, ``FigureCanvasBase.set_linestyle``,
- ``FigureCanvasQTAgg.blitbox``,
- passing non-numbers to ``EngFormatter.format_eng``,
- passing ``frac`` to ``PolarAxes.set_theta_grids``,
- any mention of idle events,
11 changes: 0 additions & 11 deletions lib/matplotlib/backend_bases.py
Original file line number Diff line number Diff line change
Expand Up @@ -2337,13 +2337,7 @@ def on_press(event):
print('you pressed', event.button, event.xdata, event.ydata)

cid = canvas.mpl_connect('button_press_event', on_press)

"""
if s == 'idle_event':
cbook.warn_deprecated(1.5,
"idle_event is only implemented for the wx backend, and will "
"be removed in matplotlib 2.1. Use the animations module "
"instead.")

return self.callbacks.connect(s, func)

Expand Down Expand Up @@ -2428,11 +2422,6 @@ def stop_event_loop(self):
"""
self._looping = False

start_event_loop_default = cbook.deprecated(
"2.1", name="start_event_loop_default")(start_event_loop)
stop_event_loop_default = cbook.deprecated(
"2.1", name="stop_event_loop_default")(stop_event_loop)


def key_press_handler(event, canvas, toolbar=None):
"""
Expand Down
34 changes: 11 additions & 23 deletions lib/matplotlib/ticker.py
Original file line number Diff line number Diff line change
Expand Up @@ -1253,43 +1253,31 @@ def format_eng(self, num):
'1.0 M'

>>> format_eng("-1e-6") # for self.places = 2
u'-1.00 \N{GREEK SMALL LETTER MU}'

`num` may be a numeric value or a string that can be converted
to a numeric value with ``float(num)``.
'-1.00 \N{GREEK SMALL LETTER MU}'
"""
if isinstance(num, six.string_types):
warnings.warn(
"Passing a string as *num* argument is deprecated since"
"Matplotlib 2.1, and is expected to be removed in 2.3.",
mplDeprecation)

dnum = float(num)
sign = 1
fmt = "g" if self.places is None else ".{:d}f".format(self.places)

if dnum < 0:
if num < 0:
sign = -1
dnum = -dnum
num = -num

if dnum != 0:
pow10 = int(math.floor(math.log10(dnum) / 3) * 3)
if num != 0:
pow10 = int(math.floor(math.log10(num) / 3) * 3)
else:
pow10 = 0
# Force dnum to zero, to avoid inconsistencies like
# Force num to zero, to avoid inconsistencies like
# format_eng(-0) = "0" and format_eng(0.0) = "0"
# but format_eng(-0.0) = "-0.0"
dnum = 0.0
num = 0.0

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

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

Expand Down