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

Fix Legend.set_draggable() with update="bbox"#25428

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
greglucas merged 1 commit intomatplotlib:mainfromdaniilS:draggable-legend-bbox
Mar 11, 2023

Conversation

@daniilS
Copy link
Contributor

Typo causesLegend.set_draggable(True, update="bbox") to be broken.

self._update_loc(self.get_loc_in_canvas())
elifself._update=="bbox":
self._bbox_to_anchor(self.get_loc_in_canvas())
self._update_bbox_to_anchor(self.get_loc_in_canvas())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Does that mean none of this is tested?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

It only gets triggered when dragging a legend, afaik mpl isn't testing any interactivity, is it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I think it's possible to test interactivity. However, whoever put the typo in didn't test, or tested the wrong thing, so perhaps add to the PR description whatever test you are using to ensure this is the correct fix?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

It is possible to test the interactive code, but I think that is way too big of an ask to get a 1 line patch in!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Yes, sorry, I wasn't meaning to ask for that if its hard, but at least some idea how this should be tested manually.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

@daniilS, since you seem to be doing some interactive PRs, you might be interested in taking a look here for how zoom and other interactive things like widgets are tested:https://github.com/matplotlib/matplotlib/blob/b636e9ed82b930ad4bde0b51360855fa79a7b438/lib/matplotlib/tests/test_backend_bases.py#LL142C3-L142C3

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

@greglucas good point - I think all my other PRs were visual changes or toolbar behaviour which is hard to test automatically, but I might be able to write a test for dragging legends as the interaction is happening entirely within the axes.

@tacaswelltacaswell modified the milestones:v3.8.0,v3.7.2Mar 10, 2023
@tacaswell
Copy link
Member

Looks like this was broken in0f7770a (?!) so this is apparently not a well used bit of functionality.

@tacaswell
Copy link
Member

importmatplotlib.pyplotaspltplt.plot(range(5),label='bob')leg=plt.legend()leg.set_draggable(True,update='bbox')plt.show()

is enough (with some dragging) to reproduce.

daniilS reacted with thumbs up emoji

Copy link
Member

@tacaswelltacaswell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

manually tested with code in comments.

@tacaswell
Copy link
Member

the appeveyor failure is#25416

@greglucasgreglucas merged commitb636e9e intomatplotlib:mainMar 11, 2023
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull requestMar 11, 2023
rcomer added a commit that referenced this pull requestMar 11, 2023
…428-on-v3.7.xBackport PR#25428 on branch v3.7.x (Fix Legend.set_draggable() with update="bbox")
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@jklymakjklymakjklymak left review comments

@greglucasgreglucasgreglucas approved these changes

@tacaswelltacaswelltacaswell approved these changes

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

v3.7.2

Development

Successfully merging this pull request may close these issues.

4 participants

@daniilS@tacaswell@jklymak@greglucas

[8]ページ先頭

©2009-2025 Movatter.jp