0
imshow animate using ArtistAnimationの例を使用して、ファイルから取得した一連の2D配列をアニメーション化しようとしています。これを行うには、関数内でArtistAnimationを使用する必要がありますが、この単純な変更は私にはわからないTypeErrorを与えます。私が行った変更は、次のとおりです。Matplotlibを使用した例外タイプエラーimshow animate with ArtistAnimation
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
def f(x, y):
return np.sin(x) + np.cos(y)
x = np.linspace(0, 2 * np.pi, 120)
y = np.linspace(0, 2 * np.pi, 100).reshape(-1, 1)
# ims is a list of lists, each row is a list of artists to draw in the
# current frame; here we are just animating one artist, the image, in
# each frame
def animate(x,y):
fig = plt.figure()
ims = []
for i in range(60):
x += np.pi/15.
y += np.pi/20.
im = plt.imshow(f(x, y), animated=True)
ims.append([im])
ani = animation.ArtistAnimation(fig, ims, interval=50, blit=True,
repeat_delay=1000)
# ani.save('dynamic_images.mp4')
plt.show()
そして、私は受信TypeError例外メッセージです:
In [23]: animate(x,y)
Exception TypeError: TypeError("'instancemethod' object is not connected",) in <bound method TimerQT.__del__ of <matplotlib.backends.backend_qt5.TimerQT object at 0x7f964ea06150>> ignored
ここに示すコードはほとんど意味がありません。この例を変更する理由は何ですか? – ImportanceOfBeingErnest