title: xdata and ydata must be the same length
body: <p>I am trying to get my plot of temperature data to update by replacing the past 10 iterations with the next 10 as seen in the code before but I keep getting a "xdata and ydata must be the same length" error. Along with fixing the error, is this the best way to do such a task of replacing a certain amount of old data with new data on a real time plot? Note: there is a little more code in the file but it is just for opening and reading the labjack equipment</p>
  
  <pre><code>temperature = []
  x = list()
  y = list()
  x1 = list()
  y1 = list()
  
  # Read loop
  for i in range(60):
      # Get the thermocouple reading on AIN0. 
      tempC = ljm.eReadName(handle, "AIN0_EF_READ_A")
      temperature.append(tempC)
      dT = temperature[i]-temperature[i-1]
  
      if -.5&lt;dT&lt;.5:
          print "Temperature:","%.3f"% temperature[i],"         " "dT:", "%.3f"% dT, "         " "Steady State" 
          sleep(1)
      else:
          print "Temperature:","%.3f"% temperature[i],"         " "dT:", "%.3f"% dT
          sleep(1) 
  
      x.append(i)
      y.append(temperature[i])
  
      x1.append(i)
      y1.append(dT)
  
      fig = plt.figure()
      ax = fig.add_subplot(111)
      li, = ax.plot(x,y)
  
  
      # draw and show it
      fig.canvas.draw()
      plt.show(block=False)
  
      # loop to update the data
      while True:
          try:
              y[:-10] = y[10:]
              y.append(temperature[i])
  
              # set the new data
              li.set_ydata(y)
  
              fig.canvas.draw()
  
              sleep(1)
          except KeyboardInterrupt:
              break
  # Close handle
  ljm.close(handle)
  </code></pre>