Skip to content

Seamless animation! #53

Open
Open
@lukelbd

Description

@lukelbd

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:

  1. 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 pass FuncAnimation keyword args perhaps by using an animation_kw argument.
  2. When calling e.g. fig.save('animation.gif') (or perhaps something like fig.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 with animate=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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions