I AM try to mark some location in pyqtgraph,
Here is the code.
def set_history_arrow(self):
print(f"===> up: {len(self.up)} down: {len(self.down)}")
for up in self.up:
print("up", self.up.index(up))
up_arrow = pg.TextItem('↑', fill=(255, 0, 0))
self.plot_widget.addItem(up_arrow)
up_arrow.setPos(up, self.data[up])
for down in self.down:
print("down", self.down.index(down))
down_arrow = pg.TextItem("↓", fill=(0, 238, 118))
self.plot_widget.addItem(down_arrow)
down_arrow.setPos(down, self.data[down])
the sum of data is: 41363
the count of them,
===> up: 4259 down: 2559
it is slow to execute it.
How can I improve the speed?
Advertisement
Answer
just use ScatterPlotItem will work