在我的 Mac OSX 机器上浏览 matplotlib 的动画示例 - http://matplotlib.org/examples/animation/simple_anim.html - 我收到这个错误:-
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/animation.py", line 248, in _blit_clear
a.figure.canvas.restore_region(bg_cache[a])
AttributeError: 'FigureCanvasMac' object has no attribute 'restore_region'
有没有遇到过这个问题的人知道如何解决这个问题?
看起来这是一个已知问题(在撰写本文时尚未解决) - https://github.com/matplotlib/matplotlib/issues/531
最佳答案
设置好了
blit=False
当animation.FuncAnimation()被调用,它会工作。
例如(from double_pendulum_animated):
ani = animation.FuncAnimation(fig, animate, np.arange(1, len(y)), interval=25, blit=False, init_func=init)
关于python - Mac OSX - 属性错误 : 'FigureCanvasMac' object has no attribute 'restore_region' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13216520/