i'd make animation matplotlib.animation dynamically updates text , title assigned axes in each frame.
import numpy np import matplotlib.pyplot plt import matplotlib.animation animation fig = plt.figure() ax = plt.axes() def func(year): # return data # 1d numpy array example def plot_data(year): d = func(year) ax.set_title(year) ax.text(1, 2, year) return ax.bar(np.array([1,2]), d) # bar plot bars = [] year in years: bars.append(plot_data(year)) anim = animation.artistanimation(fig, bars) plt.show()
the output contains cluttered titles , texts when displaying animation. there way that?
i'd appreciate comment of help.