下記を参考にmatplotlibのアニメーションを試してみた。
import numpy as np import matplotlib.pyplot as plt import matplotlib.animation as animation fig = plt.figure() MAX_FRAME = 100 def plot(frame): """.""" plt.cla() xs1 = np.arange(0, 10, .01) ys1 = np.sin(xs1) xs2 = np.arange(0, 10.0 / MAX_FRAME * frame, .01) ys2 = np.sin(xs2) _ = plt.scatter(xs1, ys1) _ = plt.scatter(xs2, ys2) ani = animation.FuncAnimation(fig, plot, frames=range(MAX_FRAME), interval=100) ani.save(f, writer="imagemagick") plt.close() f