title: matplotlib scatter, pull data from column, only show newest data point
body: <p>How do I pull data from columns 4 and 5 on a csv file? Also how do I only show the most recent data point? The older points can disappear.</p>
  
  <p>Below is what I have so far and below that is an example of the csv file.</p>
  
  <pre><code>import matplotlib.pyplot as plt
  import matplotlib.animation as animation
  import time
  
  fig = plt.figure()
  ax1 = fig.add_subplot(1,1,1)
  
  
  def animate(i):
      pullData = open("sampleText.csv","r").read()
      dataArray = pullData.split('\n')
      xar = []
      yar = []
  
      for eachLine in dataArray:
          if len(eachLine)&gt;1:
              x,y = eachLine.split(',')
              xar.append(int(x))
              yar.append(int(y))
  
      ax1.scatter(xar,yar)
  
      ax1.set_xlim([-100, 100])
      ax1.set_xlabel('X')
  
      ax1.set_ylim([-100, 100])
      ax1.set_ylabel('Y')
  
  ani = animation.FuncAnimation(fig, animate, interval=100)
  plt.show()
  </code></pre>
  
  <p>Example CSV, File contains no header. Column 4 is 'x' and 5 is 'y'.</p>
  
  <pre><code>1,2,54,-34,54,23,65,
  2,3,54,-34,-98,12,43,
  3,6,54,34,56,76,89,
  87,90,54,34,23,43,98,
  44,98,54,-34,65,34,23,
  23,79,54,34,-98,23,12,
  9,3,54,34,65,34,32,
  </code></pre>