-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Create a reference example for set_data
and friends
#19520
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This reference example should also mention the |
Just to note it would also be great to include the 3d animations as well. As |
I would add that ideally set_data should be part of the API for the other types of plot (scatter, bar, etc.) as well. It's very confusing that they each have their own method. Moreover, some of the other methods are not as flexible, for example bar's set_heights cannot be used to add data that would create new bars, as far as I know. I'm curious what the reason is for excluding set_data from the scatter and bar API's. Would it be possible to add it? |
@bkestelman The API is the way it is for "historical reasons" as each of the Artists grew organically. The problem you are identifying actually run much deeper as each Artist stores its data is a slightly different way which makes writing a generic On the bright side, addressing this problem is one of the goals of the first two grants from CZI (supporting research) and a NASA gant (which will be starting shortly) to implement it. See https://github.com/matplotlib/2020-NASA-ROSES-E7 for more details on what we are planning to do over the next 3 years. |
@tacaswell Thanks for the informative reply and the link. I'll keep an eye on those plans and see if I can contribute anywhere. |
Problem
It's tricky to learn that you should use
set_data
when animating. When i first got into this I was essentially doing: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 ofset_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 equivalentax
) 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
The text was updated successfully, but these errors were encountered: