Skip to content

Commit

Permalink
DOC: edits from review
Browse files Browse the repository at this point in the history
Co-authored-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
  • Loading branch information
tacaswell and QuLogic committed May 16, 2020
1 parent 8998de7 commit bf6aa62
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions tutorials/intermediate/blitting.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
'Blitting' is a `standard technique
<https://en.wikipedia.org/wiki/Bit_blit>`__ in computer graphics that
in the context of matplotlib can be used to (drastically) improve
in the context of Matplotlib can be used to (drastically) improve
performance of interactive figures. It is used internally by the
:mod:`~.animation` and :mod:`~.widgets` modules for this reason.
Expand All @@ -17,7 +17,7 @@
The procedure to save our work is roughly:
- draw the figure, but exclude an artists marked as 'animated'
- draw the figure, but exclude any artists marked as 'animated'
- save a copy of the Agg RBGA buffer
In the future, to update the 'animated' artists we
Expand Down Expand Up @@ -67,8 +67,8 @@


###############################################################################
# This example works and shows a simple animation, however because we are only
# grabbing the background once, if the size of dpi of the figure change, the
# The previous example works and shows a simple animation, however because we are only
# grabbing the background once, if the size or dpi of the figure change, the
# background will be invalid and result in incorrect images. There is also a
# global variable and a fair amount of boiler plate which suggests we should
# wrap this in a class.
Expand Down Expand Up @@ -107,8 +107,7 @@ def __init__(self, canvas, animated_artists):
self.cid = canvas.mpl_connect('draw_event', self.on_draw)

def on_draw(self, event):
"""Callback to register with 'draw_event'
"""
"""Callback to register with 'draw_event'."""
cv = self.canvas
if event is not None:
if event.canvas != cv:
Expand All @@ -117,7 +116,8 @@ def on_draw(self, event):
self._draw_animated()

def add_artist(self, art):
"""Add a artist to be managed
"""
Add an artist to be managed.
Parameters
----------
Expand All @@ -132,15 +132,13 @@ def add_artist(self, art):
self._artists.append(art)

def _draw_animated(self):
"""Draw all of the animated artists
"""
"""Draw all of the animated artists."""
fig = self.canvas.figure
for a in self._artists:
fig.draw_artist(a)

def update(self):
"""Update the screen with animated artists
"""
"""Update the screen with animated artists."""
cv = self.canvas
fig = cv.figure
# paranoia in case we missed the draw event,
Expand Down

0 comments on commit bf6aa62

Please sign in to comment.