I am trying to animate a text box in a Matplotlib figure, but can't seem to get it working. Does anyone know how to do this properly? An example is below.
from matplotlib import animation
import matplotlib.pyplot as plt
import numpy as np
from mpl_toolkits.basemap import Basemap
fig = plt.figure()
ax = fig.add_subplot(111)
times = ['first', 'second', 'third']
time_text = ax.text(.5, .5, '', fontsize=15)
def updatefig(num):
global mt
mt = ax.text(.5, .5, times[num], fontsize=15)
anim = animation.FuncAnimation(fig, updatefig, frames=len(times)-1, blit=True, init_func=init)