5
5
6
6
'Blitting' is a `standard technique
7
7
<https://en.wikipedia.org/wiki/Bit_blit>`__ in computer graphics that
8
- in the context of matplotlib can be used to (drastically) improve
8
+ in the context of Matplotlib can be used to (drastically) improve
9
9
performance of interactive figures. It is used internally by the
10
10
:mod:`~.animation` and :mod:`~.widgets` modules for this reason.
11
11
17
17
18
18
The procedure to save our work is roughly:
19
19
20
- - draw the figure, but exclude an artists marked as 'animated'
20
+ - draw the figure, but exclude any artists marked as 'animated'
21
21
- save a copy of the Agg RBGA buffer
22
22
23
23
In the future, to update the 'animated' artists we
67
67
68
68
69
69
###############################################################################
70
- # This example works and shows a simple animation, however because we are only
71
- # grabbing the background once, if the size of dpi of the figure change, the
70
+ # The previous example works and shows a simple animation, however because we are only
71
+ # grabbing the background once, if the size or dpi of the figure change, the
72
72
# background will be invalid and result in incorrect images. There is also a
73
73
# global variable and a fair amount of boiler plate which suggests we should
74
74
# wrap this in a class.
@@ -107,8 +107,7 @@ def __init__(self, canvas, animated_artists):
107
107
self .cid = canvas .mpl_connect ('draw_event' , self .on_draw )
108
108
109
109
def on_draw (self , event ):
110
- """Callback to register with 'draw_event'
111
- """
110
+ """Callback to register with 'draw_event'."""
112
111
cv = self .canvas
113
112
if event is not None :
114
113
if event .canvas != cv :
@@ -117,7 +116,8 @@ def on_draw(self, event):
117
116
self ._draw_animated ()
118
117
119
118
def add_artist (self , art ):
120
- """Add a artist to be managed
119
+ """
120
+ Add an artist to be managed.
121
121
122
122
Parameters
123
123
----------
@@ -132,15 +132,13 @@ def add_artist(self, art):
132
132
self ._artists .append (art )
133
133
134
134
def _draw_animated (self ):
135
- """Draw all of the animated artists
136
- """
135
+ """Draw all of the animated artists."""
137
136
fig = self .canvas .figure
138
137
for a in self ._artists :
139
138
fig .draw_artist (a )
140
139
141
140
def update (self ):
142
- """Update the screen with animated artists
143
- """
141
+ """Update the screen with animated artists."""
144
142
cv = self .canvas
145
143
fig = cv .figure
146
144
# paranoia in case we missed the draw event,
0 commit comments