I'm fairly new to all this, so I was hoping you guys might be able to help 
with this. Here's my code to start with:

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

app = QtGui.QApplication([])

view = gl.GLViewWidget()
view.show()

grid = gl.GLGridItem()
grid.scale(1,1,1)
view.addItem(grid)

# Verts and Faces that create a cube
verts = np.array([
[0, 0, 0], #0
[0, 0, 1], #1
[0, 1, 0], #2
[0, 1, 1], #3
[1, 0, 0], #4
[1, 0, 1], #5
[1, 1, 0], #6
[1, 1, 1] #7
])

faces = np.array([
[0, 4, 6],
[0, 6, 2],
[1, 5, 7],
[1, 7, 3],
[2, 6, 3],
[3, 7, 6],
[0, 4, 1],
[1, 5, 4],
[4, 5, 7],
[4, 6, 7],
[0, 1, 3],
[0, 2, 3]
])

# data set that contains [x, y, z, color] data.
data = [[0, 0, 0, .123], [0, 0, 1, .234], [0, 1, 0, .345], [0, 1, 1, .456], 
[1, 0, 0, .567], [1, 0, 1, .678], [1, 1, 0, .789], [1, 1, 1, .890]]
  
for i in range(0, len(data)):
    

    colorData = matplotlib.cm.hot(data[i][3])    
    colors = np.tile(colorData, (12, 1))
        
    m1 = gl.GLMeshItem(vertexes=verts, faces=faces, faceColors=colors, 
smooth=False)
    m1.translate(data[i][0], data[i][1], data[i][2])
    m1. setGLOptions('opaque')
    glview.addItem(m1)


if __name__ == '__main__':
    import sys
    if (sys.flags.interactive != 1) or not hasattr(QtCore, 'PYQT_VERSION'):
        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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pyqtgraph/21db3727-e871-42bf-88bd-b816d504222e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to