【发布时间】:2016-05-11 23:26:48
【问题描述】:
根据标题,我想知道是否可以暂停 matplotlib ArtistAnimation。我知道它是 possible to pause when using FuncAnimation,但我不确定该方法是否可以应用于 ArtistAnimation。
一个没有暂停的ArtistAnimation的例子是
import matplotlib.pyplot as plt
from matplotlib.animation import ArtistAnimation
import numpy as np
fig, ax = plt.subplots()
ax.set(xlim=(0, 2*np.pi), ylim=(-1, 1))
x = np.linspace(0, 2*np.pi, 100)
ims = [] # Blank list that will contain all frames
for frame in range(50):
line, = ax.plot(x, np.sin(x + 0.1*frame), color='k')
# Add new element to list with everything that changes between frames
ims.append([line])
anim = ArtistAnimation(fig, ims, interval=100)
【问题讨论】:
标签: python animation matplotlib