1

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. enter image description here

coolswastik
  • 489
  • 1
  • 9
  • 23

1 Answers1

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