-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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
Animation stops working after upgrade to matplotlib 3.3.2 #18837
Comments
On master, this gives a warning:
So this looks to be a duplicate of #18438 where the culprit is garbage collection destroying your animation before it is used. OTOH I won't close because I find the warning not very helpful in trying to fix the problem in your code. What is the user supposed to do here to get the animation to run when |
Apparently the user can return the
|
Oh, duh. Thanks! Is it ok to close this then? |
Would it help to pull the paragraph under this table in this section into a warning box? https://matplotlib.org/api/animation_api.html?highlight=animation#animation As a side note, in 3.4 via #17826 we added the ability to pause/resume the animation. I am more surprised that this ever worked.... |
I guess it might make a difference. The problem was that the same note was already present in 3.2.2 version, but then the animation worked. I know because I compared 3.2.2 and 3.3.2 and the only changes that were flaged were some errata and the HTMLwriter. |
This change bisects to 0539da4 . The key change is 0539da4#diff-8cc60f6e5a45e5dfd502623cdb3c033d7b2bbb63a0f55d0a49485f6390bcba26L1241-L1245 which was unintentionally smuggling a a hard-reference to the animation object into the callbacks through a closure on a lambda. If you set @npapnet I'm sorry we caught you with this edge case, but I think that the "bug" here was that we were accidentally keeping |
I'm very sad for being responsible for accidentally getting rid of such a ref-via-closure :) |
Bug report
Bug summary
The following code for an animated visualization stopped working after an upgrade from matplotlib 3.2.2 to 3.3.2.
Code for reproduction
Below is a minimum code for reproducible problem.
Actual outcome
The actual outcome of the code is the following figure. I.e. an empty plot with all xlabels but there is no plot of the line.
Additionally, something that might help with the debugging, is that if the last two lines in the
create_animated_plot()
are uncommented,the resulting gif works as expected (see below).
Expected outcome
The code at the end of the post moves a line up and down in the y direction. It does that successfully with matplotlib 3.2.2, but not with 3.3.2. This is reproducible in different settings.
This code was tested on the following setups (C1, C2, C3 are different computers) with the same results:
Tested with:
Tested with:
Tested with:
In all cases, when I upgraded the problem appeared, and when I downgraded the problem disappeared.
Matplotlib version
print(matplotlib.get_backend())
): Qt5AggIn machine C1, and C2 I installed through conda.
The text was updated successfully, but these errors were encountered: