Animation of BOLD signal in for loop with Nilearn

Hello. I am trying to code an animation of the change of a BOLD signal along time. The file is from OpenNeuro.org and I am using NiBabel to load the file and NiLearn to do the plot.

The idea is that the functional scan at t=0 is plotted and after 0.05 seconds, it is updated with the next one, t=1. But it is not plotting anything at all; it only shows up this error…

How can I do this? It shouldn’t be complicated…

This is not an error, these are warnings.
you probably want to open the images in a brwoser:
view_img(…).open _in_browser()
but this will open a new tab for each view.
I think I would save each image as a a png and simply generate an animation from them (aviconv or ffmpeg should be able to do this).
Best,

I think part of the confusion here is that these images are actually embedded HTML, rather than traditional static figures from e.g. matplotlib.

Since you don’t intend to interact with them (but just generate an animation), I’d agree with Bertrand to just create the animation from a series of PNGs. This would likely be better done with something like plotting.plot_anat rather than plotting.view_img !

If you’ve found a particular view you like with view_img on a single frame, you can make sure that these cuts are shown by passing the cut_coords param to plot_anat.