I have a pyqtgraph.PlotWidget with several curves and want to remove data points within a range specified via mouse clicks. I can get the position of the mouse clicks with
def mousePressEvent(self, QMouseEvent):
pos = QMouseEvent.pos()
but this position is of course in pixels of the widget and not in the units of the plot (time and amplitude). To find the data points that should be removed, I now have to either transform this pixel range to plot units, or access the pixels where the data points are displayed.
As this code should be integrated into a rather big project, I cannot mess too much with the given classes. I have read about the mapToDevice method as used in this question, but I was not able to get that working.
Does someone have an idea? Is someone able to explain to me how to use the mapTo* methods propperly in this case? Or can someone show me where to find a propper tutorial on interactive pyqtgraphs? Thanks in advance.