python - Mac OSX - 属性错误 : 'FigureCanvasMac' object has no attribute 'restore_region'

标签 python macos matplotlib

在我的 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/

相关文章:

python - "ElementNotInteractableException"尝试单击先前隐藏的 div、selenium python 内的元素

python - Django - 在上传图像时使用 instance.id

macos - 如何在 OS X 10.10 (Yosemite) 上的 Safari 8.0 中以编程方式删除 cookie

python绘制一维波动方程(初学者)

python - 来自 pandas 数据帧的图中的分组堆积条

python - 绘制直方图

python - 左旋转数组

python - 如何创建具有 z 相关填充颜色的 matplotlib 线

php - 在 mac 上更新 php 版本

objective-c - 如果 CFDictionaryRef 不存在则崩溃