0

I found an interesting animation of a particle system that I would like to implement on jupyter notebook. So I copied the code in the file collision.py and pasted it on my jupyter notebook. After executing the code I am getting only a static picture

enter image description here

I tried to include the magic command %matplotlib inline but it still does not work. Does someone know why?

4

2 回答 2

1

You need to save it as a gif file. Then open it in jupyter notebook

于 2021-01-27T12:53:13.617 回答
1

当我运行您显示的代码时,collision.mp4将保存在本地,我可以将其作为动画播放。如果要在jupyter环境下运行动画,需要安装以下代码。

# Jupyter lab
from IPython.display import HTML
%matplotlib inline

(Omission)

# plt.show()

# jupyter lab 
plt.close()
HTML(anim.to_html5_video())

这只是我所做的一个例子。请尝试这个 SO 答案,因为它非常有帮助。

于 2021-01-27T13:06:36.760 回答