I am trying to run this matplotlib animation python code but it keeps crashing after first run. It should repeat like animation so later I can take it out as gif/movie file.
After crash error : "Process finished with exit code -1073740791 (0xC0000409)" there is no much information about this exit code.
Maybe it has something to do with plt.cla() but when added it messes up everything hope anyone can help on this.
fig = plt.figure()
plt.ylim((5, 15))
plt.xlim((0, 5))
plt.grid(True)
act_ht = [[10, 10, 10], [13, 13, 13], [12, 10, 6]]
heights = [0, 0, 0]
positions = [1, 2, 3]
bars = plt.bar(positions, heights, width=0.5, align='center')
bars_coll = [bar for bar in bars]
def init():
return bars_coll
def animate(i):
global bars_coll, heights
heights = act_ht[i]
for h, bar in zip(heights, bars_coll):
bar.set_height(h)
return bars_coll
anim = animation.FuncAnimation(fig, animate, init_func=init, frames=100, interval=500, blit=True, repeat=True)
plt.show()