Mihai Miulescu
Mihai Miulescu

Reputation: 11

pyqtgraph : Multiple colors in PyQtGraph

Can I plot multiple channels with different colors in pyqtgraph with ArrayToQPath?

path = pg.arrayToQPath(xdata.flatten(), ydata.flatten(), conn.flatten())
item = QtGui.QGraphicsPathItem(path)
item.setPen(pg.mkPen('w')) 
plt.addItem(item)

Upvotes: 1

Views: 2524

Answers (1)

Luke
Luke

Reputation: 11644

QGraphicsPathItem only supports drawing with a single color, so unfortunately it is necessary to create one item per color. For example, see examples/MultiPlotSpeedTest.py.

If this is not fast enough for you, consider using an OpenGL-based vis. library. VisPy has an example of this in examples/demo/gloo/realtime_signals.py.

Upvotes: 2

Related Questions