使用FuncAnimation在matplotlib动画的等值线图 [英] Animating a contour plot in matplotlib using FuncAnimation

查看:506
本文介绍了使用FuncAnimation在matplotlib动画的等值线图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图创造matplotlib动画,更新三位艺术家,包括imshow,轮廓和文字。使用FuncAnimation我能够更新文本和图像组件,但一直没能更新等值线。具体来说,我想这是我的回调:

I am trying to create an animation in matplotlib that updates three artists, including imshow, contour and text. Using FuncAnimation I am able to update the text and the image components, but have not been able to update the contour. Specifically, I tried this as my callback:

def updatefig(*args):
    text_component.set_text(newText())
    image_component.set_array(newArrayData())
    contour_component.set_array(newArrayData())
    return [text_component,image_component,contour_component]

这code没有引发异常,但它也不更新等高线。我不知道这是早晚的事情我不知道,如果有更多的权利setter方法​​。谁能告诉我,如果这是可能的?

This code doesn't raise an exception but neither does it update the contour lines. I wonder if this is just a matter my not knowing the right setter method of if there is more to it. Can anyone tell me if this is possible?

谢谢,

推荐答案

我didn't全面了解您的code(也因为它是不完整的),我想,而评论你的问题比回答吧.. (但我没有足够的声誉,能够做到这一点!)

I didn´t full understand your code (also because it is not complete) and I would like rather to comment your question than answering it... (but I don't have enough reputation to be able to do it!)

反正...我认为这个问题可能与轮廓本身,它返回不是一个艺术家有关,但QuadContourSet实例!你觉得这可能是什么问题?我有类似的东西ArtistAnimation ...

Anyway... I think the problem might be related with the contour itself, which returns not an Artist, but a QuadContourSet instance! Do you think this might be the problem? I had something similar with the ArtistAnimation...

如果这一点,你必须的冲QuadContourSet,直到它像一个
艺术家
......我能解决我的问题,在链接的所有信息!

If this is the point, you have to "punch the QuadContourSet until it behaves like an Artist"... I could solve my problem with all the information in the link!

祝你好运!

这篇关于使用FuncAnimation在matplotlib动画的等值线图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆