title: Multiple updating plot with pyqtgraph in Python
body: <p>I have to plot 3 updating curves of data I read from a sensor. The updating plot is very fast when I use just a curve but when I try to plot them all each of them is drastically slower. The code I use is following:</p>
  
  <pre><code>#!/usr/bin/python
  
  
  from pyqtgraph.Qt import QtGui, QtCore
  import pyqtgraph as pg
  
  import time
  import numpy as np
  
  
  app = QtGui.QApplication([])
  
  
  
  win = pg.GraphicsWindow()
  
  p1 = win.addPlot()
  p2 = win.addPlot()
  p3 = win.addPlot()
  
  
  curve1 = p1.plot()
  
  curve2 = p2.plot()
  
  curve3 = p3.plot()
  
  readData = [0.0, 0.0, 0.0]
  y1=[0.0]
  y2=[0.0]
  y3=[0.0]
  
  temp = [0.0]
  
  start = time.time()
  
  def update():
      global curve1, curve2, curve3
      t = time.time()-start         # measure of time as x-coordinate
      readData= readfun()        #function that reads data from the sensor it returns a list of 3 elements as the y-coordinates for the updating plots
      y1.append(readData[0])
      y2.append(readData[1])
      y3.append(readData[2])
      temp.append(t)
  
      curve1.setData(temp,y1)
      curve2.setData(temp,y2)
      curve3.setData(temp,y3)
      app.processEvents()
  
  
  
  timer = QtCore.QTimer()
  timer.timeout.connect(update)
  timer.start(0)
  
  
  
  
  if __name__ == '__main__':
      import sys
      if (sys.flags.interactive != 1) or not hasattr(QtCore, 'PYQT_'):
          QtGui.QApplication.instance().exec_()
  </code></pre>
  
  <p>How can I speed up the updating plotting for the three curves ?
  Thanks</p>
  
  <p><strong>EDIT:</strong> Inspired by dirkjot's solution I want edit my above code in the case someone will need it for the same purpose. It works fine:</p>
  
  <pre><code>#!/usr/bin/python
  
  
  from pyqtgraph.Qt import QtGui, QtCore
  import pyqtgraph as pg
  
  import time
  import numpy as np
  
  
  app = QtGui.QApplication([])
  
  win = pg.GraphicsWindow()
  
  p1 = win.addPlot()
  p2 = win.addPlot()
  p3 = win.addPlot()
  
  
  curve1 = p1.plot()
  
  curve2 = p2.plot()
  
  curve3 = p3.plot()
  
  readData = [0.0, 0.0, 0.0]
  y1=np.zeros(1000,dtype=float)
  y2=np.zeros(1000,dtype=float)
  y3=np.zeros(1000,dtype=float)
  
  indx = 0
  def update():
      global curve1, curve2, curve3, indx, y1,y2,y3
  
      readData= readfun()        #function that reads data from the sensor it returns a list of 3 elements as the y-coordinates for the updating plots
      y1[indx]=readData[0]
      y2[indx]=readData[1]
      y3[indx]=readData[2]
  
      if indx==99:
         y1=np.zeros(1000,dtype=float)
         y2=np.zeros(1000,dtype=float)
         y3=np.zeros(1000,dtype=float)
      else:
         indx+=1
      curve1.setData(y1)
      curve2.setData(y2)
      curve3.setData(y3)
      app.processEvents()
  
  
  
  timer = QtCore.QTimer()
  timer.timeout.connect(update)
  timer.start(0)
  
  
  
  
  if __name__ == '__main__':
      import sys
      if (sys.flags.interactive != 1) or not hasattr(QtCore, 'PYQT_'):
          QtGui.QApplication.instance().exec_()
  </code></pre>