3

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]

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?

Thanks, Eli

1 Answer 1

1

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!)

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...

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!

Good luck!

Sign up to request clarification or add additional context in comments.

2 Comments

For what it's worth, this is very much an answer (and a good one) rather than a comment. Don't worry about posting it as an answer rather than a comment!
Agree with Joe, and hopefully by accepting I'll be helping your reputation. I apologize for the incompleteness of the code in the question -- I agree it wasn't enough to be replicable but this does seem to be the answer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.