本文整理汇总了Python中matplotlib.backends.backend_qt5agg.FigureCanvasQTAgg.mouseMoveEvent方法的典型用法代码示例。如果您正苦于以下问题:Python FigureCanvasQTAgg.mouseMoveEvent方法的具体用法?Python FigureCanvasQTAgg.mouseMoveEvent怎么用?Python FigureCanvasQTAgg.mouseMoveEvent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类matplotlib.backends.backend_qt5agg.FigureCanvasQTAgg
的用法示例。
在下文中一共展示了FigureCanvasQTAgg.mouseMoveEvent方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: mouseMoveEvent
# 需要导入模块: from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg [as 别名]
# 或者: from matplotlib.backends.backend_qt5agg.FigureCanvasQTAgg import mouseMoveEvent [as 别名]
def mouseMoveEvent(self, event):
FigureCanvasQTAgg.mouseMoveEvent(self, event)
pixel_x = event.x()
pixel_y = event.y()
ra, dec = self._gc.pixel2world(pixel_x, pixel_y)
inverted = self._fig.gca().transData.inverted()
x, y = inverted.transform((pixel_x, pixel_y))
try:
if x < 0 or y < 0:
value = None
else:
value = self._gc._data[self._gc._data.shape[0] - y][x]
except IndexError:
value = None
self.hoverSignal.emit(x, y, value, ra, dec)
示例2: mouseMoveEvent
# 需要导入模块: from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg [as 别名]
# 或者: from matplotlib.backends.backend_qt5agg.FigureCanvasQTAgg import mouseMoveEvent [as 别名]
def mouseMoveEvent(self, event):
FigureCanvas.mouseMoveEvent(self, event)
self.VCursor.moveLines(x=event.x(),
y=self.frameSize().height() - event.y())