title: Animate / update a matplotlib plot in VS Code notebook
body: <p>Using Jupyter Notebook, I can create an animated plot (based on <a href="https://matplotlib.org/3.2.1/gallery/animation/simple_anim.html" rel="noreferrer">this sample code</a>):</p>
  <pre><code>%matplotlib notebook
  import numpy as np
  import matplotlib.pyplot as plt
  import matplotlib.animation as animation
  
  fig, ax = plt.subplots()
  
  x = np.arange(0, 2*np.pi, 0.01)
  line, = ax.plot(x, np.sin(x))
  
  def init():
      line.set_ydata([np.nan] * len(x))
      return line,
  
  def animate(i):
      line.set_ydata(np.sin(x + i / 100))  # update the data.
      return line,
  
  ani = animation.FuncAnimation(
      fig, animate, init_func=init, interval=2, blit=True, save_count=50)
  
  plt.show()
  </code></pre>
  <p>Is it possible to do so in Visual Studio Code's notebook editor? I think it involves the magic <code>%matplotlib notebook</code> mode which VS Code does not seem to support, but I don't know if there is an alternative.</p>