0
根據標題,我想知道是否可以暫停matplotlib ArtistAnimation。我知道它是possible to pause when using FuncAnimation,但我不確定該方法可以應用於ArtistAnimation。暫停matplotlib 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)