我RemoteGraphicsView()
在 PyQTGraph 的功能上遇到问题。我有一个 numpy ndarray,我希望将其绘制在 RemoteGraphicsView 上(以提高速度,因为它在单独的进程中运行)。我想绘制数据的一部分,但它因 TypeError 而失败
TypeError: must be string or single-segment read-only buffer, not numpy.ndarray
以下是一个代码片段,它演示了我在一个更大的程序中遇到的问题。可以看出,数据是一个被切片的 numpy.ndarray。
import pyqtgraph as pg
import numpy as np
import pyqtgraph.widgets.RemoteGraphicsView
app = pg.mkQApp()
datview = pg.widgets.RemoteGraphicsView.RemoteGraphicsView(debug=False)
datview.pg.setConfigOptions(antialias=True)
allplots = datview.pg.GraphicsLayout()
datview.setCentralItem(allplots)
w1 = allplots.addPlot(row=0,col=0)
layoutWG = pg.LayoutWidget()
layoutWG.addWidget(datview)
layoutWG.show()
data = np.random.randn(10000,100)
curve1 = w1.plot(pen='r')
now = pg.ptime.time()
for n in range(100):
curve1.setData(data[:,n])
app.processEvents()
app.exec_()
任何帮助将非常感激。