我經歷了這個簡單的例子,這將有助於我與我的問題就來了:如何將動態pyplot保存爲電影文件?
"""
Pyplot animation example.
The method shown here is only for very simple, low-performance
use. For more demanding applications, look at the animation
module and the examples that use it.
"""
import matplotlib.pyplot as plt
import numpy as np
x = np.arange(6)
y = np.arange(5)
z = x * y[:,np.newaxis]
for i in xrange(5):
if i==0:
p = plt.imshow(z)
fig = plt.gcf()
plt.clim() # clamp the color limits
plt.title("Boring slide show")
else:
z = z + 2
p.set_data(z)
print "step", i
plt.pause(0.5)
這顯示pyplot界面的動畫,但我想保存該動畫在某些電影格式,是有辦法?
謝謝你的鏈接。我知道matplotlib.animation,但我浪費了一整天的時間試圖實現我的問題(不是這個例子),但沒有成功,我需要動畫在今天完成,所以我很絕望,我會很生氣一旦我找到一種方法來理解matplotlib.animation的用法,我發現它非常不直觀,這樣做是正確的。 – enedene
我第二個這個建議。關於改善matplotlib存儲庫主分支中可用的節省電影方面的最新工作。動態編碼電影比保存圖像然後合併它們要快得多。 – tacaswell