How to animate a bar char being updated in Python
<p>I want to create an animated, stacked bar chart.</p>

<p>There is a <a href="https://jakevdp.github.io/blog/2012/08/18/matplotlib-animation-tutorial/" rel="noreferrer">great tutorial</a>, which shows how to animate line graphs.</p>

<p>However, for animating bar charts, the BarContainer object, does not have any attribute to 'set_data'. I am therefore forced to clear the figure axes each time, e.g. ,</p>

<pre><code>fig=plt.figure()

def init():
    plt.cla()

def animate(i):

    p1 = plt.bar(x_points,y_heights,width,color='b')

return p1


anim = animation.FuncAnimation(fig,animate,init_func=init,frames=400,interval=10,blit=False)
</code></pre>

<p>Is there an alternative option, following the style of the link, such that I do not have to clear the axes each time? Thanks.</p>