I'm running Mac OS-X 10.8.1, with python 2.7.3, numpy 1.8.0, matplotlib 1.2, 
and wxPython 2.9.3.1 (although wx isn't involved here, at least I don't think 
so).  I'm running on a dual-quad processor Xeon Mac Pro.

I decided to learn something about animated matplotlib graphics, so started to 
look at the examples in http://matplotlib.sourceforge.net/examples/animation/...

I consistently run into a problem, illustrated below.  Starting from the 
animate_decay.py code, copied and pasted into an editor as here:

#!/usr/bin/env python
"""
 http://matplotlib.sourceforge.net/examples/animation/animate_decay.html
"""

import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation

def data_gen():
 t = data_gen.t
 cnt = 0
 while cnt < 1000:
     cnt+=1
     t += 0.05
     yield t, np.sin(2*np.pi*t) * np.exp(-t/10.)
data_gen.t = 0

fig = plt.figure()
ax = fig.add_subplot(111)
line, = ax.plot([], [], lw=2)
ax.set_ylim(-1.1, 1.1)
ax.set_xlim(0, 5)
ax.grid()
xdata, ydata = [], []
def run(data):
 # update the data
 t,y = data
 xdata.append(t)
 ydata.append(y)
 xmin, xmax = ax.get_xlim()

 if t >= xmax:
     ax.set_xlim(xmin, 2*xmax)
     ax.figure.canvas.draw()
 line.set_data(xdata, ydata)

 return line,

ani = animation.FuncAnimation(fig, run, data_gen, blit=True, interval=10,
 repeat=False)
plt.show()


If I attempt to run this script (or any of several others), I get:

StraylightPro:Matplotlib_stuff wrw$ ./animate_decay.py
Traceback (most recent call last):
File 
"/Library/Python/2.7/site-packages/matplotlib-1.2.x-py2.7-macosx-10.8-intel.egg/matplotlib/backend_bases.py",
 line 1117, in _on_timer
 ret = func(*args, **kwargs)
File 
"/Library/Python/2.7/site-packages/matplotlib-1.2.x-py2.7-macosx-10.8-intel.egg/matplotlib/animation.py",
 line 763, in _step
 still_going = Animation._step(self, *args)
File 
"/Library/Python/2.7/site-packages/matplotlib-1.2.x-py2.7-macosx-10.8-intel.egg/matplotlib/animation.py",
 line 625, in _step
 self._draw_next_frame(framedata, self._blit)
File 
"/Library/Python/2.7/site-packages/matplotlib-1.2.x-py2.7-macosx-10.8-intel.egg/matplotlib/animation.py",
 line 645, in _draw_next_frame
 self._post_draw(framedata, blit)
File 
"/Library/Python/2.7/site-packages/matplotlib-1.2.x-py2.7-macosx-10.8-intel.egg/matplotlib/animation.py",
 line 668, in _post_draw
 self._blit_draw(self._drawn_artists, self._blit_cache)
File 
"/Library/Python/2.7/site-packages/matplotlib-1.2.x-py2.7-macosx-10.8-intel.egg/matplotlib/animation.py",
 line 682, in _blit_draw
 bg_cache[a.axes] = a.figure.canvas.copy_from_bbox(a.axes.bbox)
AttributeError: 'FigureCanvasMac' object has no attribute 'copy_from_bbox'
Traceback (most recent call last):
File 
"/Library/Python/2.7/site-packages/matplotlib-1.2.x-py2.7-macosx-10.8-intel.egg/matplotlib/backend_bases.py",
 line 1117, in _on_timer
 ret = func(*args, **kwargs)
File 
"/Library/Python/2.7/site-packages/matplotlib-1.2.x-py2.7-macosx-10.8-intel.egg/matplotlib/animation.py",
 line 763, in _step
 still_going = Animation._step(self, *args)
File 
"/Library/Python/2.7/site-packages/matplotlib-1.2.x-py2.7-macosx-10.8-intel.egg/matplotlib/animation.py",
 line 625, in _step
 self._draw_next_frame(framedata, self._blit)
File 
"/Library/Python/2.7/site-packages/matplotlib-1.2.x-py2.7-macosx-10.8-intel.egg/matplotlib/animation.py",
 line 643, in _draw_next_frame
 self._pre_draw(framedata, blit)
File 
"/Library/Python/2.7/site-packages/matplotlib-1.2.x-py2.7-macosx-10.8-intel.egg/matplotlib/animation.py",
 line 656, in _pre_draw
 self._blit_clear(self._drawn_artists, self._blit_cache)
File 
"/Library/Python/2.7/site-packages/matplotlib-1.2.x-py2.7-macosx-10.8-intel.egg/matplotlib/animation.py",
 line 696, in _blit_clear
 a.figure.canvas.restore_region(bg_cache[a])
AttributeError: 'FigureCanvasMac' object has no attribute 'restore_region'


…and the 'restore-region' error sequence then repeats endlessly.

I'm hoping this is all caused by my not quite having the right library 
installed someplace along the line.  If anyone could point it out, I'd sure 
appreciate it.

Thanks,
Bill
_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG

Reply via email to