As the title describe, my plot disappear when the option blitting is On. I explain a bit further : I am making animations to diplay the solution of some differential equations and the code will become more and more heavy. I need the blitting option to have a smooth animation but I also need a button to start/stop the animation. I am using FuncAnimation. The thing is when I stop the animation with the "myAnimation.event_source.stop()" command, the plot disappear as long as the animation is on pause and comes back animated when I restart with "myAnimation.event_source.start()". I've tried to find the issue in matplotlib documentation : https://matplotlib.org/3.2.1/_modules/matplotlib/animation.html#FuncAnimation however this is too much for me to corner what could be modified. Do you have an idea how to solve my problem ? Code : (funcanimation part and stop button part, A is a matrice for my specific code)
def update(self,i):
self.myAnimation.event_source.interval = self.Constants['interv']
self.k = i%10
self.n[:,self.k] = self.A*self.n[:,self.k-1]
self.p.set_ydata(self.n[:,self.k])
return self.p,
def _stopp(self,event):
if self.Launch:
self.myAnimation = aniamtion.FuncAnimation(self.fig, self.update, frames=range(1,self.Constants['N']), interval=self.Constants['interv'],repeat=False)
self.Launch=False
else:
if self.anim_running:
self.myAnimation.event_source.stop()
self.anim_running = False
else:
self.myAnimation.event_source.start()
self.anim_running = True
def add_button(self,left,name):
axbutton=plt.axes([left,0.88, 0.12, 0.05])
bstop = Button(axbutton, name)
self.Launch=True
self.Button.append(bstop)