Starting with
from dolfin import *
mesh = UnitSquareMesh(nx, ny)
V = FunctionSpace(mesh, "CG", 1)
I do some processing and obtain a list u
of length 20
(where each member of this list is an object of class Function(V)
and has been obtained as the solution to a certain boundary-value problem on mesh
).
I would like to make an animation which:
- plots (a 2-dimensional view of)
u[0]
- holds for 0.5 seconds
- hides
u[0]
and plots (a 2-dimensional view of) u[1]
- holds for 0.5 seconds
- etc.
I have tried using the plot command inside a loop, but then I have to indivually close each window by hand and each new plot pops up at a different location on the screen.
Instead, I would like to produce an animation in one window only; also, I would like to store this animation for later use. Could someone propose a way of accomplishing these tasks? (I would prefer a solution that does not require any external software, but any suggested solutions would be welcome!)