I am trying to save the frames from a matplotlib animation and I have a
question that is undoubtedly based on a profound lack of understanding about
how matplotlib/python works, but I'm hoping someone can offer me an
explanation. The following code is excerpted from the animation examples
"animation_blit_wx.py". The example works fine unless I include the #*****
line meant to record the animations in included. If the line is included, the
animated line is no longer drawn to the screen or to the sequence of plots I am
trying to save. That is, the background is displayed and saved, but not the
animated line. Why?
def update_line(*args):
global blit_time
if update_line.background is None:
update_line.background = canvas.copy_from_bbox(ax.bbox)
# restore the clean slate background
canvas.restore_region(update_line.background)
# update the data
line.set_ydata(npy.sin(x+update_line.cnt/10.0))
# just draw the animated artist
ax.draw_artist(line)
# just redraw the axes rectangle
t = time.time()
canvas.blit(ax.bbox)
blit_time += time.time() - t
#***** plt.savefig('f' + str(update_line.cnt) + '.png') *****
if update_line.cnt == NBLITS:
# print the timing info and quit
frame_time = time.time() - tstart
print '%d frames: %.2f seconds' % (NBLITS, frame_time)
print '%d blits: %.2f seconds' % (NBLITS, blit_time)
print
print 'FPS: %.2f' % (NBLITS/frame_time)
print 'BPS: %.2f' % (NBLITS/blit_time)
sys.exit()
update_line.cnt += 1
wx.WakeUpIdle()
------------------------------------------------------------------------------
Sell apps to millions through the Intel(R) Atom(Tm) Developer Program
Be part of this innovative community and reach millions of netbook users
worldwide. Take advantage of special opportunities to increase revenue and
speed time-to-market. Join now, and jumpstart your future.
http://p.sf.net/sfu/intel-atom-d2d
_______________________________________________
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users