Description
I think it would be really awesome if users could generate mp4s and gifs by passing arrays with an extra "time" dimension and the keyword arg animate=True
to arbitrary plotting functions.
The following approach would allow users to animate stuff in multiple subplots, possibly with multiple plotting commands, simultaneously:
- If
animate=True
, anticipate an extra "time" dimension on the input data, and select the first time index for drawing the initial frame. They can passFuncAnimation
keyword args perhaps by using ananimation_kw
argument. - When calling e.g.
fig.save('animation.gif')
(or perhaps something likefig.animate(...)
), create an animation by calling the same plotting commands with the same keyword args with successive time slices. This should also make sure the "time dimension" lengths are identical for all arrays passed to plotting commands withanimate=True
.
This is not release critical but seems like such an obvious and useful addition... whenever I have to make animations I have to look up boilerplate code and write code that manually creates and destroys successive artists, which is surely very easy to automate. One difficulty might be allowing users to control how text objects, labels, annotations, legends, etc. are updated with each iteration, but will cross that bridge when we come to it.
Edit: To clarify, the reason I am considering this is ProPlot already standardizes the positional arguments passed to plotting functions with standardize_1d
and standardize_2d
. So it would be straightforward to have these functions handle a third "animation" dimension.