Reputation: 1035
Okay, so I am trying to create some animation in matplotlib. I am doing this on Jupyter-Notebook.
I am converting the animation using to_html5_video()
. And displaying it using HTML()
. The problem is that this video is not fitting in my cell.
fig, ax = plt.subplots()
l, = ax.plot([],[], "k.")
ax.set_xlim([0,L])
ax.set_ylim([0,L])
def animate(i):
l.set_data(xPos[:i], yPos[:i])
ani = animation.FuncAnimation(fig, animate,frames=len(xPos)).to_html5_video()
HTML(ani)
How do I fit it properly?
Upvotes: 2
Views: 276
Reputation: 627
When I had this problem I found that I could make the video smaller by using plt.rcParams["savefig.dpi"] = 100
. This gave me the notion that my config was somehow bad, so I simply deleted ~/.matplotlib/matplotlibrc
and the sample code for animations now render correctly.
Upvotes: 1