Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4c97b63

Browse files
author
Steve Chaplin
committed
'SC'
svn path=/trunk/matplotlib/; revision=1627
1 parent e9a58ac commit 4c97b63

1 file changed

Lines changed: 13 additions & 9 deletions

File tree

examples/animation_blit.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,22 @@
1-
# For detailed comments on animation and the techniqes used here, see
1+
#!/usr/bin/env python
2+
3+
# For detailed comments on animation and the techniques used here, see
24
# the wiki entry
35
# http://www.scipy.org/wikis/topical_software/MatplotlibAnimation
4-
import matplotlib
5-
matplotlib.use('GTKAgg')
66
import sys
7+
import time
8+
79
import gtk, gobject
8-
import pylab as p
10+
11+
import matplotlib
12+
matplotlib.use('GTKAgg')
913
import matplotlib.numerix as nx
10-
import time
14+
import pylab as p
15+
1116

1217
ax = p.subplot(111)
1318
canvas = ax.figure.canvas
1419

15-
1620
# create the initial line
1721
x = nx.arange(0,2*nx.pi,0.01)
1822
line, = p.plot(x, nx.sin(x), animated=True, lw=2)
@@ -27,12 +31,12 @@ def update_line(*args):
2731
# restore the clean slate background
2832
canvas.restore_region(update_line.background)
2933
# update the data
30-
line.set_ydata(nx.sin(x+update_line.cnt/10.0))
34+
line.set_ydata(nx.sin(x+update_line.cnt/10.0))
3135
# just draw the animated artist
3236
ax.draw_artist(line)
3337
# just redraw the axes rectangle
34-
canvas.blit(ax.bbox)
35-
38+
canvas.blit(ax.bbox)
39+
3640
if update_line.cnt==200:
3741
# print the timing info and quit
3842
print 'FPS:' , 200/(time.time()-tstart)

0 commit comments

Comments
 (0)