python import numpy as np import pyqtgraph as pg app = pg.QtGui.QApplication([]) win = pg.GraphicsWindow(title="PyQtGraph Interactive Plotting") x = np.linspace(0, 10, 100) y = np.sin(x) plot = win.addPlot(title="Interactive Plot") vLine = pg.InfiniteLine(angle=90, movable=False) hLine = pg.InfiniteLine(angle=0, movable=False) plot.addItem(vLine, ignoreBounds=True) plot.addItem(hLine, ignoreBounds=True) def mouseMoved(evt): if plot.sceneBoundingRect().contains(pos): x = mousePoint.x() y = mousePoint.y() vLine.setPos(x) hLine.setPos(y) plot.scene().sigMouseMoved.connect(mouseMoved) app.exec_()


上一篇:
下一篇:
切换中文