-
Notifications
You must be signed in to change notification settings - Fork 194
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
Animations do not render #127
Comments
Hi, |
I'm running the example from a script, with the TkAgg backend. As a side note, I cannot save the animation without my hack. I would get the following error: |
Interesting, I was always able to save the animations but I've pushed your change, bf136b1. Let's see if everything else still works... |
Spoken like a true developer! 😆 I have been working with my hack without noticeable issue until now at least, so that seems fine. More broadly, I often run into the issue of generating animations with matplotlib with my own projects, and I can say that closing the figures is rarely necessary. More importantly, I used to use the same tricks to save the animation (see line 389) Line 389 in 1c14b08
The issue with this strategy is that it can result in a big memory leak as the animation is saved until a new animation is loaded. Usually I force the display of the animation and then return it, so this line may be unnecessary. It can become annoying, but I guess users are not supposed to use PhiFlow to run several minutes of animation. |
So it turns out that not closing the figure causes the animation to appear twice in Jupyter notebooks, even though no show() is called. Not returning it would be one possible fix but that is inconsistent. Do you know why it's showing up in the first place? |
I didn't check that, but I think one of the animation displaying is the output from the function, the other the figure we prepared that renders (matplotlib is always a bit annoying because of that). Because returning the animation is nice, and that we want to close the figure, the easiest "fix" is to assign the output of the variable so that it is not displayed in Jupyter. |
Okay, for now I only close the plot when Jupyter is active. But maybe a better solution would be to to put a |
Hello there!
As I just discovered this package, I have been following Fluids Tutorial to see whether I could have a nice animation. Unfortunately, copying exactly the provided code do not display anything.
I get one error warning after running
vis.plot(trajectory, animate='time')
(input [7] from the tutorial):An easy fix I used was to remove
plots.close(figure)
onPhiFlow/phi/vis/_vis.py
Line 390 in 1c14b08
Doing so, the animation displays normally.
User Specifications
Please tell me if you need more information!
The text was updated successfully, but these errors were encountered: