Skip to content Skip to sidebar Skip to footer

FuncAnimation Being Called Too Many Times

This is a continuation of a previous question I asked. I noticed the values being used to update my pie chart were incorrect. I have a list z that is being updated with the num ite

Solution 1:

Without an init_func= passed to FuncAnimation, it will use the animation function itself as the initial state, which causes your doublet 0. The documentation states:

init_func : callable, optional

A function used to draw a clear frame. If not given, the results of drawing from the first item in the frames sequence will be used. This function will be called once before the first frame.

You can simply pass an empty function to fix the problem.

def init():
    pass

(...)

ani = animation.FuncAnimation(fig, update, frames=range(10), init_func=init, repeat=False)

Post a Comment for "FuncAnimation Being Called Too Many Times"