以下のコードを実行すると、カラーバーが内側に1描写ごとにどんどんできていきます。
plt.colorbar()を消すと、正しく動作します。
どこを直したらいいかご教示いただけないでしょうか。
海外の質問サイト(未解決)にて似たような出力画像を見つけました(link)
python
1import numpy as np 2import matplotlib 3import matplotlib.pyplot as plt 4import matplotlib.animation as animation 5from PIL import Image 6import moviepy.editor as edit 7from mpl_toolkits.axes_grid1 import make_axes_locatable 8def update(k): 9 plt.cla() # clear axis 10 #<ここにValの更新が入る(省略) 11 plt.contourf(X0, Y0, Val, cmap = "bwr") 12 plt.colorbar() 13 plt.axes().set_aspect("equal") 14 plt.title("title-name") 15 16fig = plt.figure() 17 18# アニメーション作成 19# interval [ms]毎に画像が切り替わる。 20# framse回、画像を更新する。updateの第一引数は0,1,2,...,frames-1を動く。 21ani = animation.FuncAnimation(fig, update, interval=100 ,frames=400) 22ani.save("out.gif", writer='imagemagick')
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。