#try this way:

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()

On Tue, Feb 28, 2017 at 3:09 PM, tykom <[email protected]> wrote:

> Hi All,
>
> Just started using pyqtgraph and it's pretty great, love the speed. I've
> gotten the demos to work pretty easily, but I'm trying to add it to a
> project that I've been developing using atom as an IDE with the Script
> plugin and the windows that pyqtgraph creates close instantly. This happens
> if I run the same file from the terminal too. But if I use pyqtgraph
> directly from terminal, it's fine.
>
> I've followed the tips from this thread
> <https://groups.google.com/forum/?fromgroups#!msg/pyqtgraph/grVGbN3sMQA/vJWyXe-GJD0J;context-place=forum/pyqtgraph>
> to no avail. And searching about hasn't yielded anything promising.
>
> This is the demo code that I've been testing:
>
> import numpy as np
> import pyqtgraph as pg
> import pyqtgraph.multiprocess as mp
> import time
>
> pg.mkQApp()
> proc = mp.QtProcess()
> rpg = proc._import('pyqtgraph')
>
> win = rpg.GraphicsWindow()
> plot1 = win.addPlot()
> x = np.linspace(0, 10, 10)
> y = np.linspace(-5, 5, 10)
> curve = plot1.plot(x, y)    # x,y can be lists, arrays, etc.
> curve.setPen('r')
> win.show()
> time.sleep(2)
>
> adding time.sleep keeps the window open for the specified interval but
> also defeats the purpose of interactive plotting...
>
> thanks for any help!
>
> --
> 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/66efd2f5-a78a-418a-b381-ed1cfea87c14%40googlegroups.com
> <https://groups.google.com/d/msgid/pyqtgraph/66efd2f5-a78a-418a-b381-ed1cfea87c14%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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_qyJr_XvSNCCXXSHhxn0ezyC6B2WNs1mvytO_QvS1%3DSgKbQA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to