Skip to content Skip to sidebar Skip to footer

Matplotlib Subplot Animation With Basemap

I am trying to generate a four-panel animation of temperature change with time. Each of the four panels in the subplot should be an animated map; the difference between each panel

Solution 1:

Your animation function needs to update four different maps in four separate axes within the figure.

  • Create your four panels:

    fig, ax = plt.subplots(2, 2)
    

The axes are indexed. The way I suggested placing them in a 2x2 layout, they are indexed as a 2-d array, so reference the axes as ax[0][0], ax[0][1], ax[1][0], and ax[1][1] when you create the maps.

  • When you create your four instances of Basemap, assign each map to a different axes using the ax parameter (docs).

  • In your animate function, change the coloring of each axes. Assigning colors based on data to map m_i is with m_i.pcolormesh(docs) as shown in your question.

Post a Comment for "Matplotlib Subplot Animation With Basemap"