title: animation.Funcanimation() Matplotlib / How to use it properly?
body: <p>Sample Data:</p>
  <hr />
  <pre><code>Area    Africa  Asia    Europe  N_America   S_America   Australia   Antarctica
  Y1961   -0.17   0.49    8.74    0.17    1.16    1.51    2.80
  Y1962   -0.40   -0.08   3.00    -0.58   -1.39   1.23    -2.27
  Y1963   0.64    2.66    1.03    3.72    1.39    -1.14   1.35
  Y1964   -1.53   -1.66   -5.23   -2.85   -2.17   -0.22   -3.66
  Y1965   -1.97   -0.33   -4.30   -5.94   -0.15   1.27    -0.99
  
  
  </code></pre>
  <p>Code:</p>
  <hr />
  <pre><code>n=len(Continents.index)
  fig,ax=plt.subplots()
  def action(curr): 
      global colors
      global cmap
      global Continents
      global color_dict
      if curr==n:
          a.event_source.stop()
      CURR=Continents.iloc[curr] 
      ax = plt.gca()
      ticks(curr)
      bars = plt.bar(Continents.columns,CURR,color=[color_dict[country] for country in Continents.columns]) 
      for bar,height in zip(bars,CURR):
          return bar.set_height(height)
           
  a = animation.FuncAnimation(fig,action, interval=100, frames=np.array(range(0,n)))
  </code></pre>
  <p>When I use my action function separately, it works, but I cannot use it in animation.Funcanimation() function. I want to change bar heights according to year.</p>
  <p><a href="https://i.stack.imgur.com/y5mwk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/y5mwk.png" alt="enter image description here" /></a></p>