On Wed, Mar 1, 2017 at 5:48 AM, tykom <[email protected]> wrote:

> import numpy as np
> import pyqtgraph as pg
> import pyqtgraph.multiprocess as mp
> import time
>
> qapp = pg.mkQApp()
> proc = mp.QtProcess()
> rpg = proc._import('pyqtgraph')
>
> win = rpg.GraphicsWindow()
> plot1 = win.addPlot()
> curve = plot1.plot()
> curve.setPen('r')
> win.show()
>
> x = np.linspace(0, 10, 10)
> y = np.linspace(-5, 5, 10)
> curve.setData(x,y)
>
> # you need to process and set data and call processEvents() in the loop
> while win.isVisible():
>     y = y + np.random.random(10) # comment out this row not to update with
> different value
>     curve.setData(x,y) # comment out this row not to update with different
> value
>     qapp.processEvents()
>


#also, this works much faster (for me):

import numpy as np
import pyqtgraph as pg

qapp = pg.mkQApp()
win = pg.GraphicsWindow()
plot1 = win.addPlot()
curve = plot1.plot()
curve.setPen('r')
#win.show()

x = np.linspace(0, 10, 10)
y = np.linspace(-5, 5, 10)
curve.setData(x,y)

# you need to process and set data and call processEvents() in the loop
while win.isVisible():
    y = y + np.random.random(10) # comment out this row not to update with
different value
    curve.setData(x,y) # comment out this row not to update with different
value
    qapp.processEvents()

-- 
You received this message because you are subscribed to the Google Groups 
"pyqtgraph" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pyqtgraph/CAD_qyJrzLq2AtSpDwjXzUom812ZMr2eASiG2HZBpuA87Lt4OZg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to