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