WebAgg backend by mdboom · Pull Request #1426 · matplotlib/matplotlib · GitHub
Skip to content
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
8 changes: 4 additions & 4 deletions examples/widgets/slider_demo.py
7 changes: 5 additions & 2 deletions lib/matplotlib/animation.py
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,10 @@ class Animation(object):
'''
def __init__(self, fig, event_source=None, blit=False):
self._fig = fig
self._blit = blit
# Disables blitting for backends that don't support it. This
# allows users to request it if available, but still have a
# fallback that works if it is not.
self._blit = blit and fig.canvas.supports_blit

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems a little unfriendly. If I ask for blitting, I would expect to get it - otherwise I should get an error. What do you think?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This deserves some explanation. Some backends, such as WebAgg, do not support blitting. In the case of WebAgg, it's because blitting is not possible -- we don't have direct access to the window/screen buffers anyway, so there is no advantage to it. This allows code that was written to expect blitting (such as all of the examples/animation examples) to still work. There should be consistent behavior across backends, even when certain features are not available.


# These are the basics of the animation. The frame sequence represents
# information for each frame of the animation and depends on how the
Expand All @@ -543,7 +546,7 @@ def __init__(self, fig, event_source=None, blit=False):
# fire events and try to draw to a deleted figure.
self._close_id = self._fig.canvas.mpl_connect('close_event',
self._stop)
if blit:
if self._blit:
self._setup_blit()

def _start(self, *args):
Expand Down
11 changes: 0 additions & 11 deletions lib/matplotlib/axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -2116,17 +2116,6 @@ def redraw_in_frame(self):
def get_renderer_cache(self):
return self._cachedRenderer

def __draw_animate(self):
# ignore for now; broken
if self._lastRenderer is None:
raise RuntimeError('You must first call ax.draw()')
dsu = [(a.zorder, a) for a in self.animated.keys()]
dsu.sort(key=lambda x: x[0])
renderer = self._lastRenderer
renderer.blit()
for tmp, a in dsu:
a.draw(renderer)

#### Axes rectangle characteristics

def get_frame_on(self):
Expand Down
2 changes: 2 additions & 0 deletions lib/matplotlib/backend_bases.py
Loading