这是进行瀑布表示的尝试。我需要用不同的颜色表示信号(数组)值(幅度/电平/密度),而不是像所做的那样以阴影表示。因为我是算法和信号处理工程师。而不是软件开发人员,我不熟悉彩色地图和这些东西。因此,如果有人可以用将颜色与信号值相关联的代码来帮助我。
from pyqtgraph.Qt import QtCore, QtGui
import pyqtgraph.opengl as gl
import scipy.ndimage as ndi
import numpy as np
Nf = 90 # No. of frames
Ns = 100 # Signal length
app = QtGui.QApplication([])
w_SA = QtGui.QWidget(); w_SA.setFixedSize(400, 400)
# Create a GL View widget to display data
plt_SA1 = gl.GLViewWidget(w_SA); plt_SA1.move(10, 10); plt_SA1.resize(380, 380)
plt_SA1.setCameraPosition(elevation=90.0, azimuth=0.0, distance=70)
p1 = gl.GLSurfacePlotItem(shader='shaded', color=(0.5, 0.5, 1, 1), smooth=False)
p1.translate(-Nf/2, -Ns/2, 0)
plt_SA1.addItem(p1)
Arx = np.zeros([Nf, Ns])
def update():
global Arx
Arx = np.roll(Arx, 1, axis=0)
Arx[0] = ndi.gaussian_filter(np.random.normal(size=(1,Ns)), (1,1))
p1.setData(z=Arx)
timer = QtCore.QTimer()
timer.timeout.connect(update)
timer.start(30)
w_SA.show()
if __name__ == '__main__':
import sys
if (sys.flags.interactive != 1) or not hasattr(QtCore, 'PYQT_VERSION'):
QtGui.QApplication.instance().exec_()