I am trying to create a simple animation using Cartopy. Basically just drawing a few lines in the map. So far I am trying the following:
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
import matplotlib.animation as animation
import numpy as np
ax = plt.axes(projection=ccrs.Robinson())
ax.set_global()
ax.coastlines()
lons = 10 * np.arange(1, 10)
lats = 10 * np.arange(1, 10)
def animate(i):
plt.plot([lons[i-1], lons[i]], [lats[i-1], lats[i]], color='blue', transform=ccrs.PlateCarree())
return plt
anim = animation.FuncAnimation(plt.gcf(), animate, frames=np.arange(1, 8), init_func=None, interval=2000, blit=True)
plt.show()
Does anyone know why this is not working?