簡體   English   中英

matplotlib動畫視頻不適合Jupyter_Notebook Cell

[英]matplotlib animation video not fitting in Jupyter_Notebook Cell

好的,所以我嘗試在matplotlib中創建一些動畫。 我正在Jupyter筆記本上進行此操作。

我正在使用to_html5_video()轉換動畫。 並使用HTML()顯示它。 問題是該視頻不適合我的手機。

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)

看起來像這樣: 如您所見,視頻不適合該單元格。

如何正確安裝?

遇到此問題時,我發現可以通過使用plt.rcParams["savefig.dpi"] = 100plt.rcParams["savefig.dpi"] = 100視頻。 這使我想到我的配置有些糟糕,因此我只刪除了~/.matplotlib/matplotlibrc ,現在可以正確渲染動畫的示例代碼。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM