title: How to keep updating graph on mathplt
body: <p>having trouble redrawing the graph every time receiving new data
  so I'm trying to write a program that every time get a number it redraws it self
  not sure I'm using the ion() function right</p>
  <pre><code>import matplotlib.pyplot as plt
  a = True  
  c = [1,1,2,3,5,8]
  b = True
  t = plt.figure()
  plt.xlabel('X')
  plt.ylabel('Y')
  plt.plot(c, 'r--')
  plt.ion()
  plt.show()
  while a:
      dummy = int(input())
      if dummy &lt; 0 :
          a = False
      c.append(dummy)
      t.clear()
      plt.plot(c, 'r--')
      plt.show()
      print(c)
  </code></pre>