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

[Bug]: Outline of draggable legends and annotations not respected #30378

Closed
@kaktus018

Description

@kaktus018

Bug summary

When adding draggable legends and annotations to a plot, the actual outline of them is not respected for a drag operation. Regardless of where you click & drag, every annotation and the legend is moved. This is identical to#30303 which has been closed.

Code for reproduction

importmatplotlib.pyplotaspltimportnumpyasnp# Sample datax=np.linspace(0,10,100)y1=np.sin(x)y2=np.cos(x)fig,ax=plt.subplots()line1,=ax.plot(x,y1,label='sin(x)')line2,=ax.plot(x,y2,label='cos(x)')# Add a draggable legendlegend=ax.legend()legend.set_draggable(True)# Add a draggable annotationann=ax.annotate('Peak',xy=(np.pi/2,1),xytext=(np.pi/2+1,1.2),arrowprops=dict(facecolor='black',shrink=0.05),bbox=dict(boxstyle="round,pad=0.3",fc="yellow",alpha=0.5))ann.draggable(True)plt.title('Draggable Legend and Annotation')plt.show()

Actual outcome

actual.behavior.mp4

Expected outcome

expected.behavior.mp4

Additional information

This problem happens with matplotlib version 3.10.3 and does not exist with version 3.10.1. I am using qtagg as backend (PySide6 version 6.9.1).

Operating system

Windows-11-10.0.26100-SP0

Matplotlib Version

3.10.3

Matplotlib Backend

qtagg

Python version

3.13.5

Jupyter version

No response

Installation

pip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    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