QPainterPath; unfortunately the QPainterPath is invalid/invisible if there is one (or more)
np.NaNvalues in the numpy array (this was new behavior in Qt 5.12.3) so having to screen for NaN values and fill them in was an unfortunate performance hit we had to take; would be great if we don't have to do that check at least (I can certainly open an issue in JIRA with specifics/reproducible code).
QRectF(numpy-array)where the numpy array contains elements that can be passed to the
QRectFinitializer. ... doing these in a for loop has been remarkably expensive... again, I have no problem posting an issue on the JIRA board, it makes me so happy to see you all willing to expose numpy -> graphicsview objects functionality...
QPainter.drawPixmapNp(ndarray, QPixmap)method; where
ndarrayis of shape
(n, 4)where each component corresponds to
x, y, w, hbit. This is probably the most analogous pain point we're having that's similar to the methods introduced with experimental support in PySide6 6.1... I'll detail what we currently do, but if there is something specific you'd like to see in the JIRA post, let me know and I'll be sure to include it.
QDataStream >> QPainterPathoperation, but hard to say for certain. If you happen to know what change could have caused that performance boost, I'd curious to know; but mostly wanted to say thank you :thumbsup:
>>operator. ... the nifty thing for us is that this method does not check for NaN values (this is great for us), which normally is checked for during the construction of a QPainterPath object.
arrayToQPathin this use case; the runtime dropped by a factor of 2.5 since 5.15.2 :raised_hands:
from pyqtgraph.Qt import QtGui, QtCore import numpy as np import pyqtgraph as pg from pyqtgraph.ptime import time import yappi app = pg.mkQApp("Plot Speed Test") yappi.start(builtins=True) p = pg.plot() p.setWindowTitle('pyqtgraph example: PlotSpeedTest') p.setRange(QtCore.QRectF(0, -10, 5000, 20)) p.setLabel('bottom', 'Index', units='B') curve = p.plot() data = np.random.normal(size=(50, 5000)) ptr = 0 lastTime = time() fps = None count = 0 def update(): global curve, data, ptr, p, lastTime, fps, count count += 1 if count == 500: pg.mkQApp().exit() curve.setData(data[ptr % 10], connect='all', skipFiniteCheck=True) ptr += 1 app.processEvents() ## force complete redraw for every plot timer = QtCore.QTimer() timer.timeout.connect(update) timer.start(0) if __name__ == '__main__': pg.exec()