Luke Carroll
2018-08-15 19:43:10 UTC
Hey I'm not sure if I'm posting correctly on here or if this thread is
active anymore.
When I tried running your example as a Python script I received the error:
"QWidget: Must construct a QApplication before a QWidget".
If anyone know how to construct a simple example that can produce a
pcolor-like result in pyqtgraph that would be greatly appreciated. As an
example, the script below can be ran on its own using Python 3.6 numpy 1.14
and matplotlib 2.2 to produce the image example pcolor_plot.png
import numpy as np
import matplotlib.pyplot as plt
x = np.array([[1,1,1,1],[2,2,2,2],[3,3,3,3],[4,4,4,4],[5,5,5,5]])
y = np.array([[4,8,12,16],[2,4,6,8],[3,6,9,12],[5,10,15,20],[6,12,18,24]])
z = np.array([[1,2,3,4],[5,6,7,8],[9,10,11,12],[13,14,15,16],[17,18,19,20]])
plt.pcolor(x, y, z)
plt.show()
[image: example_pcolor_plot.png] <about:invalid#zClosurez>
argument to MeshData.__init__ to set the colors properly. It would look
import pyqtgraph.opengl as gl
md = gl.MeshData(vertexes=[...], faces=[...], vertexColors=[...])
mesh = gl.GLMeshItem(meshdata=md)
view = gl.GLViewWidget()
view.addItem(mesh)
You can see examples/GLMeshItem.py for a little more help.
Is this what you are looking for?
active anymore.
When I tried running your example as a Python script I received the error:
"QWidget: Must construct a QApplication before a QWidget".
If anyone know how to construct a simple example that can produce a
pcolor-like result in pyqtgraph that would be greatly appreciated. As an
example, the script below can be ran on its own using Python 3.6 numpy 1.14
and matplotlib 2.2 to produce the image example pcolor_plot.png
import numpy as np
import matplotlib.pyplot as plt
x = np.array([[1,1,1,1],[2,2,2,2],[3,3,3,3],[4,4,4,4],[5,5,5,5]])
y = np.array([[4,8,12,16],[2,4,6,8],[3,6,9,12],[5,10,15,20],[6,12,18,24]])
z = np.array([[1,2,3,4],[5,6,7,8],[9,10,11,12],[13,14,15,16],[17,18,19,20]])
plt.pcolor(x, y, z)
plt.show()
[image: example_pcolor_plot.png] <about:invalid#zClosurez>
Hello World!
I'm basically porting a series of Matlab scripts to python, and one of
them makes heavy use of Matlab's PColor function for plotting. I've
successfully implemented the same functionality with Matplotlib, but it
isn't doing exactly what I want it to do. I discovered PyQtGraph recently
and I was wondering if there is an equivalent function I could use to
replace the Matplotlib plots I've generated?
For those who aren't familiar with PColor, the basic idea behind it is
that you give it 3 matrices, [X,Y,C]. X and Y describe vertices of
polygons to draw, and C holds the color to fill the polygon with. I'm
using radar data and my arrays are quite large ( greater than 100,000
elements in some cases ), so speed is of the essence for me. Hence my
desire to use PyQtGraph if possible.
You can use GLMeshItem to draw the polygons, and the 'vertexColors'I'm basically porting a series of Matlab scripts to python, and one of
them makes heavy use of Matlab's PColor function for plotting. I've
successfully implemented the same functionality with Matplotlib, but it
isn't doing exactly what I want it to do. I discovered PyQtGraph recently
and I was wondering if there is an equivalent function I could use to
replace the Matplotlib plots I've generated?
For those who aren't familiar with PColor, the basic idea behind it is
that you give it 3 matrices, [X,Y,C]. X and Y describe vertices of
polygons to draw, and C holds the color to fill the polygon with. I'm
using radar data and my arrays are quite large ( greater than 100,000
elements in some cases ), so speed is of the essence for me. Hence my
desire to use PyQtGraph if possible.
argument to MeshData.__init__ to set the colors properly. It would look
import pyqtgraph.opengl as gl
md = gl.MeshData(vertexes=[...], faces=[...], vertexColors=[...])
mesh = gl.GLMeshItem(meshdata=md)
view = gl.GLViewWidget()
view.addItem(mesh)
You can see examples/GLMeshItem.py for a little more help.
Is this what you are looking for?
--
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/f52b539e-eb79-4cda-800f-7e590c3844c2%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/f52b539e-eb79-4cda-800f-7e590c3844c2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.