Description
To get the estimated (x,y,z) coordinate of a mouse event in a 3D figure we must parse these values from the string generated by Axes3D.format_coord
. Wouldn't it be more useful to factor that out into a separate method (coord
?) giving access to x, y, z = proj3d.inv_transform(xd, yd, z, self.M)
? format_coord
would then simply convert that to the formatted string.
The question of how to extract these coordinates has been asked a few times on SO:
http://stackoverflow.com/questions/6748184/matplotlib-plot-surface-get-the-x-y-z-values-written-in-the-bottom-right-cor
http://stackoverflow.com/questions/28954611/how-to-extract-3d-mouse-coordinate-on-mouse-click-in-matplotlib-in-python
and aside from duplicating the code within format_coord
the best we can do is parse the values out of the generated string.