小编Bil*_*rab的帖子

get Coordinates of matplotlib plot figure python with mouse click

I have been trying to get the mouse x,y coordinates to variables according to matplotlib plot scale not pixels but it only returns me the integer components like 0.0 or 1.0 I want to return the accurate number like 0.1245 here is my code

import matplotlib
import Tkinter as tk
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2TkAgg
from matplotlib.figure import Figure
import numpy as np
import matplotlib.pyplot as plt


def onclick(self,event):
    ix, iy = float(event.xdata), float(event.ydata)

    print 'x = %d, y = …
Run Code Online (Sandbox Code Playgroud)

python tkinter matplotlib mouseevent coordinates

5
推荐指数
1
解决办法
4931
查看次数

标签 统计

coordinates ×1

matplotlib ×1

mouseevent ×1

python ×1

tkinter ×1