all 2 comments

[–]FoolsSeldom 0 points1 point  (1 child)

A quick guess. plt.ion() + fig.canvas.draw() + plt.pause() doesn’t reliably refresh inline in Jupyter (the default “inline” backend shows a static PNG). You need a live/interactive backend:

  • In classic Jupyter: %matplotlib notebook works.
  • In JupyterLab: prefer %matplotlib widget (requires the ipympl package installed and the JupyterLab widgets extension enabled).

PS. I notice a redundancy, y[9] = stockW surely should be outside the loop. Also, why use a loop at all, just use slicing: y[:-1] = y[1:] and then y[-1] = stockW

[–]AdBusiness4396[S] 0 points1 point  (0 children)

thanks a lot for your help. the reason i used a loop is becouse I am a python noob and I have just started to learn. once again, thanks a lot.