为什么我不能在调用中设置blit=Truematplotlib.animation.FuncAnimation从1.5.0开始?

2024-04-24 22:41:52 发布

您现在位置:Python中文网/ 问答频道 /正文

自从更新到matplotlib 1.5.0之后

matplotlib.animation.FuncAnimation(fig, func, init_func=func,
                                   frames=frames, 
                                   interval=1100,repeat_delay=2000, 
                                   blit=True)

结果

AttributeError: 'NoneType' object has no attribute 'set_animated'

在matplotlib中/动画.py在1134号线

^{pr2}$

{and need to continue to the continue with the errors.{and need to continue with the errors.^为了继续设置^和}。在

不管我如何更改figfunc等的值,这种情况都会发生,在1.5.0之前,这些值都可以正常工作。在

1.5.0中是否有导致这种情况的更改?我能做些什么来继续blit=True?在


Tags: andthetotrueframesmatplotlibwithfig
1条回答
网友
1楼 · 发布于 2024-04-24 22:41:52

在我的具体例子中,我制作了多个轴上分布的几条线的动画。当我设置blit=True时,我看到了相同的错误。修复方法是从我的animate()函数中更改return语句-在我从模板中获取的原始函数中,该函数看起来像

def animate(i):
...
return lines,

需要改成

^{pr2}$

blit参数必须告诉某些东西,用set_animated方法将animate返回的每个元素视为艺术家-逗号将添加额外的层次结构层,即列表中的列表而不是艺术家列表。在

相关问题 更多 >