Отображение 3D-матрицы с цветами PyqtgraphPython

Программы на Python
Anonymous
Отображение 3D-матрицы с цветами Pyqtgraph

Сообщение Anonymous »


I want to display a 3D matrix in Pyqtgraph using GLVolumeItem (with x, y and z axis) with the specific colors corresponding to the input data.

How can I proceed with my code ?

import numpy as np import pyqtgraph as pg import pyqtgraph.opengl as gl from pyqtgraph import functions as fn app = pg.mkQApp("GLVolumeItem Example") w = gl.GLViewWidget() w.show() w.setWindowTitle('pyqtgraph example: GLVolumeItem') w.setCameraPosition(distance=200) g = gl.GLGridItem() g.scale(10, 10, 1) w.addItem(g) x = np.linspace(0,10,11) y = np.linspace(0,10,11) z = np.linspace(0,10,11) data = np.zeros((10,10,10)) data[1,:,:] = 10 data[3,:,:] = 10 d2 = np.empty(data.shape + (4,), dtype=np.ubyte) v = gl.GLVolumeItem(d2) w.addItem(v) ax = gl.GLAxisItem() w.addItem(ax) if __name__ == '__main__': pg.exec() The goal is to get a 3D representation with different colors corresponding to the levels of the data.


Источник: https://stackoverflow.com/questions/780 ... -pyqtgraph

Вернуться в «Python»