Crash when using pyqtgraph in Jupyter Notebook (Python 3.5, Windows)

868 views
Skip to first unread message

Matthias Minderer

unread,
Mar 29, 2017, 6:53:03 PM3/29/17
to pyqtgraph
Hi,

I'm trying to get pyqtgraph to work for 3d line and scatter plots.

The installation worked and I can run all the examples.

I can run 2d plots from Jupyter notebook.

When I create a 3d plot, it initially works. But when I then create another plot, or close and re-draw the first one, python crashes.

Below is the code. It's copied from the 3d line plot example. First execution works, second one crashes python. (Run from a Jupyter Notebook, Python 3.5, Windows).

What am I doing wrong?

Thanks,
Matt

%gui qt5


from pyqtgraph.Qt import QtCore, QtGui
import pyqtgraph.opengl as gl
import pyqtgraph as pg
import numpy as np


# Open plot window:
app
= QtGui.QApplication([])
w
= gl.GLViewWidget()
w
.opts['distance'] = 40
w
.show()
w
.setWindowTitle('pyqtgraph example: GLLinePlotItem')


# Add grid:
gx
= gl.GLGridItem()
gx
.rotate(90, 0, 1, 0)
gx
.translate(-10, 0, 0)
w
.addItem(gx)
gy
= gl.GLGridItem()
gy
.rotate(90, 1, 0, 0)
gy
.translate(0, -10, 0)
w
.addItem(gy)
gz
= gl.GLGridItem()
gz
.translate(0, 0, -10)
w
.addItem(gz)


def fn(x, y):
   
return np.cos((x**2 + y**2)**0.5)


n
= 51
y
= np.linspace(-10,10,n)
x
= np.linspace(-10,10,100)
for i in range(n):
    yi
= np.array([y[i]]*100)
    d
= (x**2 + yi**2)**0.5
    z
= 10 * np.cos(d) / (d+1)
    pts
= np.vstack([x,yi,z]).transpose()
    plt
= gl.GLLinePlotItem(pos=pts, color=pg.glColor((i,n*1.3)), width=(i+1)/10., antialias=True)
    w
.addItem(plt)

Robin Cole

unread,
Aug 23, 2017, 9:56:53 AM8/23/17
to pyqtgraph
Hi Matt, ever get this working?
Cheers

Matthias Minderer

unread,
Aug 31, 2017, 1:41:02 PM8/31/17
to pyqt...@googlegroups.com
No, sorry, I gave up on pyqtgraph for the time being.

On Wed, Aug 23, 2017, 2:56 PM Robin Cole <robma...@gmail.com> wrote:
Hi Matt, ever get this working?
Cheers

--
You received this message because you are subscribed to a topic in the Google Groups "pyqtgraph" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/pyqtgraph/KImnC-hOTMA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to pyqtgraph+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pyqtgraph/7cf60686-45ea-4e51-acd2-312bed1a19fd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages