Paul Harper
6 years ago
I am trying to port some plotting code from matplotlib to pyqtgraph for
performance improvement.
The pyqtgraph examples give separate examples of 2d plots and 3d plots, but
I have not been able to find a sample of a 3d plot embedded as a subplot in
a 2d plot window. I have tried embedding a GLViewWidget into a
GraphicsWindow as shown below. What happens is that I can get multiple 2d
plots or multiple 3d GLViewWidgets embedded, but not both together. As soon
as I add 2d widgets to the layout, they dominate completely and I cannot
see the 3d widgets.
I have also tried adding a QGroupBox widget, with its own layout, and
adding the 3d widget to that, even trying to set the minimum Width of the
group box and the 3d widget, none of those seemed to help.
I am using Anaconda 3:
pyqt 5.6.0 py37ha878b3d_6
pyqtgraph 0.10.0 py37h28b3542_3
python 3.7.0
code sample
from pyqtgraph.Qt import QtGui, QtCoreimport numpy as npimport pyqtgraph as pgimport pyqtgraph.opengl as gl
app = QtGui.QApplication([])
win = pg.GraphicsWindow(title="A 2d plot window")
p1 = pg.PlotWidget()
# try adding a 3d plot
glvw = gl.GLViewWidget()
z = pg.gaussianFilter(np.random.normal(size=(50,50)), (1,1))
p13d = gl.GLSurfacePlotItem(z=z, shader='shaded', color=(0.5, 0.5, 1, 1))
glvw.addItem(p13d)
# get a layout
layoutgb = QtGui.QGridLayout()
win.setLayout(layoutgb)
layoutgb.addWidget(glvw, 0, 0)# layoutgb.addWidget(p1, 0, 1) ### uncommenting this line causes
#the plot widget to appear and the 3d widget to disappear
QtGui.QApplication.instance().exec_()
performance improvement.
The pyqtgraph examples give separate examples of 2d plots and 3d plots, but
I have not been able to find a sample of a 3d plot embedded as a subplot in
a 2d plot window. I have tried embedding a GLViewWidget into a
GraphicsWindow as shown below. What happens is that I can get multiple 2d
plots or multiple 3d GLViewWidgets embedded, but not both together. As soon
as I add 2d widgets to the layout, they dominate completely and I cannot
see the 3d widgets.
I have also tried adding a QGroupBox widget, with its own layout, and
adding the 3d widget to that, even trying to set the minimum Width of the
group box and the 3d widget, none of those seemed to help.
I am using Anaconda 3:
pyqt 5.6.0 py37ha878b3d_6
pyqtgraph 0.10.0 py37h28b3542_3
python 3.7.0
code sample
from pyqtgraph.Qt import QtGui, QtCoreimport numpy as npimport pyqtgraph as pgimport pyqtgraph.opengl as gl
app = QtGui.QApplication([])
win = pg.GraphicsWindow(title="A 2d plot window")
p1 = pg.PlotWidget()
# try adding a 3d plot
glvw = gl.GLViewWidget()
z = pg.gaussianFilter(np.random.normal(size=(50,50)), (1,1))
p13d = gl.GLSurfacePlotItem(z=z, shader='shaded', color=(0.5, 0.5, 1, 1))
glvw.addItem(p13d)
# get a layout
layoutgb = QtGui.QGridLayout()
win.setLayout(layoutgb)
layoutgb.addWidget(glvw, 0, 0)# layoutgb.addWidget(p1, 0, 1) ### uncommenting this line causes
#the plot widget to appear and the 3d widget to disappear
QtGui.QApplication.instance().exec_()
--
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 pyqtgraph+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pyqtgraph/f2805b26-a975-4e8d-ad3e-52548aa4edde%40googlegroups.com.
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 pyqtgraph+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pyqtgraph/f2805b26-a975-4e8d-ad3e-52548aa4edde%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.