title: implementing pyqtgraph for live data graphing
body: <p>I am trying to get a live plot of data as it is being collected by an instrument using pyqtgraph.</p>
  
  <p>The data collection is handled by the main process this is then passed over a connection to a subprocess that plots it. I am just trying to pass the new data and have it update when the new data is passed.</p>
  
  <p>I have tried to implement this by putting the connection read inside the Qt Timer update loop but then I have difficulty passing the graph data (which I want to append to) between successive update cycles. I omitted from the code below, but basically I want to join up successive lots of connData, I thought using a global would work, but for some reason I can't implement that here.</p>
  
  <p>EDIT 1: The problem that I have compared with the pyqtgraph examples seems to be passing data to the update process of the Qtimer, I get:</p>
  
  <p>NameError: global name 'CurveData' is not defined</p>
  
  <p>The reason I tried to do it this way rather than using the multiprocessing module of pyqtgraph is that I did not want to pass the entire data set over the connection each time (which I thought would be necessary). Thanks!</p>
  
  <p>EDIT 2: Is there documentation for pyqtgraph.multiprocess somewhere? </p>
  
  <p>(this is the original code provided)</p>
  
  <pre><code>import multiprocessing
  import numpy as np
  from pyqtgraph.Qt import QtCore, QtGui
  import pyqtgraph as pg
  import pyqtgraph.opengl as gl
  import sys
  import os
  
  def MakeGraph(conn):
  
      win = pg.GraphicsWindow(title = "test")
      win.resize(300,300)
  
      p1 = win.addPlot(title = "test")
  
      curve = p1.plot(pen = 'y')
      timer = QtCore.QTimer()
  
      def Update():
          try:
              ConnData = conn.recv()
              ConnData = [float(i) for i in ConnData]
              curve.setData(ConnData)
          except EOFError:
              print "Graph connection closed\n"
              timer.stop()
              QtGui.QApplication.quit()
  
      timer.timeout.connect(Update)
      timer.start(0)
  
      if (sys.flags.interactive != 1) or not hasattr(QtCore, 'PYQT_VERSION'):
              QtGui.QApplication.instance().exec_()
  </code></pre>
  
  <p>modified version:</p>
  
  <pre><code>import multiprocessing
  import numpy as np
  from pyqtgraph.Qt import QtCore, QtGui
  import pyqtgraph as pg
  import pyqtgraph.opengl as gl
  import sys
  import os
  
  def MakeGraph(conn):
  
      win = pg.GraphicsWindow(title = "test")
      win.resize(300,300)
  
      p1 = win.addPlot(title = "test")
  
      curve = p1.plot(pen = 'y')
      timer = QtCore.QTimer()
      CurveData = []
  
      def Update():
          global CurveData
          try:
              ConnData = conn.recv()
              ConnData = [float(i) for i in ConnData]
              CurveData = np.append(CurveData,ConnData)
              curve.setData(CurveData)
          except EOFError:
              print "Graph connection closed\n"
              timer.stop()
              QtGui.QApplication.quit()
  
      timer.timeout.connect(Update)
      timer.start(0)
  
      if (sys.flags.interactive != 1) or not hasattr(QtCore, 'PYQT_VERSION'):
              QtGui.QApplication.instance().exec_()
  </code></pre>