Skip to content

Create a reference example for set_data and friends #19520

Open
@ianhi

Description

@ianhi

Problem

It's tricky to learn that you should use set_data when animating. When i first got into this I was essentially doing:

for t in range(timepoints):
    ax.imshow(data[t])

which is bad news for performance. I fortunately had someone around to tell me to use set_data but lacking that I think it would have taken me a lot longer to figure out.

However, even after figuring that out it's not all smooth sailing. I was tripped up for quite awhile on how to animate a scatter plot as it uses set_offsets instead of set_data. There can also be other complications see for example #18401.

Suggested Improvement

Include a reference style example in the animation section of the gallery that goes over how to animate all the possible animatable artists (set_data, set_offsets, etc...). Or at least all of the artists that get returned from pyplot functions. Ideally the example would use the artists created from pyplot(or equivalent ax) functions as this is how I imagine most people will create the artists for their animations.

For reference I brought this up on gitter, but gitter just crashed :(

Matplotlib version

  • Matplotlib documentation version: any

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions