I am new to PyQtGraph and want to use it for a speedy visualization
of my data acquisition. Previously I was using matplotlib where
redrawing the figure was my bottleneck. After making the transition to
PyQtGraph, I am currently missing only one functionality of matplotlib.
Namely, returning the x-, and y-coordinate of my mouse cursor.
How can I call/mimic the return of the x-, and y-coordinates of my mouse cursor in a plot made using PyQtGraph?
I have had a look at the HoverEvent documentation. However, with my code I am not able to figure out how to call these functions. All the errors I produce tell me that the attribute I am trying to call is not contained by the function I am using.
A simple version of the code I will be using for my data acquisition is found below:
import numpy
import pyqtgraph as pg
from pyqtgraph.Qt import QtGui, QtCore
x = numpy.linspace(-2 * numpy.pi, 2 * numpy.pi, 1000)
y = numpy.cos(x)
# Plot
win = pg.GraphicsWindow()
win.resize(800, 800)
p = win.addPlot()
p.plot(x, y, pen = "y")
i = 0
while i < 350:
noise = numpy.random.normal(0, 1, len(y))
y_new = y + noise
p.plot(x, y_new, pen = "y", clear = True)
p.enableAutoRange("xy", False)
pg.QtGui.QApplication.processEvents()
i += 1
win.close()
class graphicsLayoutWidget(pg.GraphicsLayoutWidget): def __init__(self): pg.GraphicsLayoutWidget.__init__(self) def mouseMoveEvent(self, event): print event.pos()
app = QtGui.QApplication([])x = numpy.linspace(-2 * numpy.pi, 2 * numpy.pi, 1000)y = numpy.cos(x)
# Plotwin = graphicsLayoutWidget()win.show()win.resize(800, 800)
p = win.addPlot()p.plot(x, y, pen = "y")
i = 0while 1: noise = numpy.random.normal(0, 1, len(y)) y_new = y + noise
p.plot(x, y_new, pen = "y", clear = True) p.enableAutoRange("xy", False)
i += 1 pg.QtGui.QApplication.processEvents()win.close()To view this discussion on the web visit https://groups.google.com/d/msgid/pyqtgraph/479e2826-1a42-45f6-9efd-a10406f0276f%40googlegroups.com.--
You received this message because you are subscribed to a topic in the Google Groups "pyqtgraph" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/pyqtgraph/ZlxPGqHCZJ0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to pyqtgraph+...@googlegroups.com.