Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

mplot3d annotate uses the 2D projection coordinates system #7927

Open
Labels
keepItems to be ignored by the “Stale” Github Actiontopic: mplot3d
@anntzer

Description

@anntzer

As of 2.0,Axes3D (frommplot3d) inheritsannotate from the regular 2DAxes class. As a consequence, it takes 2D coordinates as argument (i.e., the projection done internally by mplot3d before drawing), and annotations do not follow rotation or zooming of the 3D axes.

from matplotlib import pyplot as pltfrom mpl_toolkits import mplot3dfig, ax = plt.subplots(subplot_kw={"projection": "3d"})pathcoll = ax.scatter(range(10), range(10), range(10))# ax.annotate("foo", (0, 0, 0)) raises.ax.annotate("foo", (0, 0))# Need to draw so that pathcoll.get_offsets() is updated to the 2D projection# of the coordinates.fig.canvas.draw()ax.annotate("bar", pathcoll.get_offsets()[5])plt.show()

figure_1
Note that "bar" is drawn at the correct position, which happens to be close to (0, 0) in the 2D projection used by mplot3d, so "foo" ends up close to it either.

Funnily enough, it means thatmplcursors "accidentally" works for 3D plots -- but the annotations do not follow rotation or zooming (that's how I found the issue)...

Metadata

Metadata

Assignees

No one assigned

    Labels

    keepItems to be ignored by the “Stale” Github Actiontopic: mplot3d

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp