Add to end of your code:
while w.isVisible():
app.processEvents()
That's all,
Vasilije
On Sun, Jun 30, 2019 at 8:38 PM Radhika Prasad <[email protected]> wrote:
> I have tried using the pyqtgraph surface plot example for obtaining a
> surface plot. Unfortunately, nothing appears. Please help.
> Even in the example code, if I comment out everything else except for the
> saddle surface plot, then also nothing appears.
>
> Here is the code:
>
> from pyqtgraph.Qt import QtCore, QtGui
> import pyqtgraph as pg
> import pyqtgraph.opengl as gl
> import numpy as np
>
> ## Create a GL View widget to display data
> app = QtGui.QApplication([])
> w = gl.GLViewWidget()
> w.show()
> w.setWindowTitle('pyqtgraph example: GLSurfacePlot')
> #w.setCameraPosition(distance=50)
>
> g = gl.GLGridItem()
> g.scale(2,2,1)
> g.setDepthValue(10) # draw grid after surfaces since they may be
> translucent
> w.addItem(g)
>
> x = np.linspace(-8, 8, 50)
> y = np.linspace(-8, 8, 50)
> #z = np.exp((-x.reshape(50,1) ** 2) - (y.reshape(1,50) ** 2))
> z = x.reshape(50,1)+y.reshape(1,50)
> p = gl.GLSurfacePlotItem(x=x, y=y, z=z, shader='normalColor')
> #p2.translate(-10,-10,0)
> w.addItem(p)
>
>
> --
> 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/43710773-a836-427a-816a-fa36ab2cc507%40googlegroups.com
> <https://groups.google.com/d/msgid/pyqtgraph/43710773-a836-427a-816a-fa36ab2cc507%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_qyJpCTYQF_HuZT3JM%2B4XARA_LJ76FsDT%2BqE7MCObMYp4mSQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.