Skip to content

Axes3D: factor out 3D coordinate guessing from format_coord() #4334

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ndawe opened this issue Apr 14, 2015 · 4 comments · Fixed by #23485
Closed

Axes3D: factor out 3D coordinate guessing from format_coord() #4334

ndawe opened this issue Apr 14, 2015 · 4 comments · Fixed by #23485
Milestone

Comments

@ndawe
Copy link

ndawe commented Apr 14, 2015

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.

@tacaswell
Copy link
Member

attn @WeatherGod

@tacaswell tacaswell added this to the unassigned milestone Apr 14, 2015
@tacaswell
Copy link
Member

I agree it would make sense to turn from Line 1101 to the end of the function into

def guess_xzy(self, x, y):
    ....

and then use it within format_coord.

@ndawe Any desire to take a crack at implementing this?

@ndawe
Copy link
Author

ndawe commented Apr 14, 2015

Sure, I'll open a PR.

@ndawe
Copy link
Author

ndawe commented Apr 24, 2015

Haven't forgotten... I have time this weekend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants