The 3D mouse coordinates shows in the status bar of matplotlib window. But does anybody know how to get these coordinates from the status bar or using any function of matplotlib.
Asked
Active
Viewed 3,888 times
1

coolswastik
- 489
- 1
- 9
- 23
-
2See http://stackoverflow.com/a/9673338/1002176 – ndawe Apr 14 '15 at 02:42
1 Answers
0
I don't know how you get your data, but I use this when I want the x,y from a image. In callback(event) you need event.zdata to also print the z value.
import matplotlib.pyplot as plt
import cv2
def callback(event):
print event.xdata, event.ydata, event.zdata
img = cv2.imread(file)
fig, ax = plt.subplots()
fig.canvas.callbacks.connect('button_press_event', callback)
plt.imshow(img,'gray')
plt.show()

Martijn van Wezel
- 1,120
- 14
- 25