0
def simulate(foo):
  plt.cla()
  for key in plotdata.keys():
        plt.plot(plotdata[key],label = key[:-1],color = key[-1])
  #do some stuff with data
ani = ani.FuncAnimation(plt.gcf(), simulate, interval = secsbetweengenerations * 100)
plt.legend()
plt.show()

The data is never empty, and the contents of them are always floats between 0 and 1. It shows an empty graph tho

I tried to remove

plt.cla() 

and add

plt.axis([0,plotrange-1,0,1]) 

before the animation

  • Did you look at the error produced? When I ran your (non-self contained) code I got `TypeError: simulate() takes 0 positional arguments but 1 was given` because your `simulate()` function needs to take a frame number argument. See https://matplotlib.org/stable/api/animation_api.html – Jody Klymak Feb 03 '23 at 23:15
  • @JodyKlymak I did I only forgot to put it here. There is no exception – TadoTheMiner Feb 04 '23 at 06:23
  • The reason we ask for complete, minimal., self-contained examples is so that we can tell what is wrong. Suggest you concoct such an example, and if that doesn't reveal the cause of your problem, please repost – Jody Klymak Feb 04 '23 at 22:34

0 Answers0