I’m testing an algorithm and I’d like to produce a sequence of figures displaying intermediate results using matplotlib.
I’m not needing animations, nor multiple figures all on the screens, nor subplots.
I’d just like to produce a sequence of figures (possibly using pyplot), and when I’m done, a single window is shown. Then I’d like to navigate in the sequence of figures using the arrows.
How can I do something like that?
I tried to search, but I can only find subplot or multiple figures on the screen.
Thanks
The most general approach is to create a sequence of axes in the same figure, and only display one at a time.
Here’s an example of that (The left and right arrow keys control which plot is displayed):
If they’re all the same type of plot, you could just update the data of the artists involved. This is especially easy if you have the same number of items in each plot. I’ll leave out an example for the moment, but if the example above is too memory-hungry, just updating the data of the artists will be considerably lighter.