diff --git a/lib/matplotlib/backends/backend_nbagg.py b/lib/matplotlib/backends/backend_nbagg.py index c2e18955cc1b..16d3d51e0a74 100644 --- a/lib/matplotlib/backends/backend_nbagg.py +++ b/lib/matplotlib/backends/backend_nbagg.py @@ -3,8 +3,6 @@ # lib/matplotlib/backends/web_backend/nbagg_uat.ipynb to help verify # that changes made maintain expected behaviour. -import six - from base64 import b64encode import io import json @@ -204,9 +202,7 @@ def send_json(self, content): def send_binary(self, blob): # The comm is ascii, so we always send the image in base64 # encoded data URL form. - data = b64encode(blob) - if six.PY3: - data = data.decode('ascii') + data = b64encode(blob).decode('ascii') data_uri = "data:image/png;base64,{0}".format(data) self.comm.send({'data': data_uri}) diff --git a/lib/matplotlib/backends/backend_webagg_core.py b/lib/matplotlib/backends/backend_webagg_core.py index ab9f2c3813c4..ab8fda933b98 100644 --- a/lib/matplotlib/backends/backend_webagg_core.py +++ b/lib/matplotlib/backends/backend_webagg_core.py @@ -10,11 +10,6 @@ # - `backend_webagg.py` contains a concrete implementation of a basic # application, implemented with tornado. -from __future__ import (absolute_import, division, print_function, - unicode_literals) - -import six - import datetime import io import json @@ -26,8 +21,7 @@ from matplotlib.backends import backend_agg from matplotlib.backend_bases import _Backend -from matplotlib import backend_bases -from matplotlib import _png +from matplotlib import backend_bases, _png # http://www.cambiaresearch.com/articles/15/javascript-char-codes-key-codes @@ -150,17 +144,11 @@ def show(self): show() def draw(self): - renderer = self.get_renderer(cleared=True) - self._png_is_old = True - - backend_agg.RendererAgg.lock.acquire() try: - self.figure.draw(renderer) + super().draw() finally: - backend_agg.RendererAgg.lock.release() - # Swap the frames - self.manager.refresh_all() + self.manager.refresh_all() # Swap the frames. def draw_idle(self): self.send_event("draw")