Skip to content

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

@ndawe

Description

@ndawe

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions