Matplotlib-users Digest, Vol 66, Issue 11

Hello,

Thanks for your help.

Do you need the colorbar scale to change with each frame? If not, you can create a wholly independent colorbar like so:

Yes, I do need the colour bar to update with each frame unfortunately!

What I would do is “prime the pump” by creating the first frame. Then create a func animator that calls a function that loads the cached results based on an
index number and directly update the imshow()'s object using the set_data() method.

I see what you mean here, the problem is that while I could do it I think it would take more memory because each frame is a composite if a few data sets, and also I quite like the separation of the data and the animation.

Just a thought, would it be possible to combine the two, to create a list of artists that stores the AxesImage and Line2D object I have for each subplot and then create a FuncAnimate to add a colorbar and animate them?

Or (continuing thinking this up) to create a list of axes objects (subplots) then add colorbars to them and just add them to a figure??

That way, the original colorbar sees the changes from the ScalarMappable object that was originally assigned to it. It also results in faster rendering, in my experience since imshow() has many extra steps to take to prepare the data for display.

Not really sure what you mean by faster rendering in this context, surely the rendering done when you draw the Artist in ArtistAnimate is the same speed as drawing out of a FuncAnimate?

Note, this won’t work if the domain changes over time.

What the size of the domain or the Vlim’s??

Thanks again
Stuart