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 rotation selector for aspect ratio of the axes values different from 1#21886

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

Draft
ericpre wants to merge1 commit intomatplotlib:main
base:main
Choose a base branch
Loading
fromericpre:fix_rotation_aspect_ratio

Conversation

ericpre
Copy link
Member

PR Summary

Rotate counterclockwise to notice that the selector rotate too slowly because of the aspect ratio value difference

importmatplotlib.pyplotaspltfrommatplotlib.widgetsimportRectangleSelector,PolygonSelectorimportnumpyasnpdata=np.random.random(size=(24,32))fig,ax=plt.subplots()ax.plot([10,20,30], [1,2,3])defdummy(*args):passtool=RectangleSelector(ax,dummy,interactive=True,drag_from_anywhere=True)tool.extents= (12,20,1.0,1.6)tool.add_state('rotate')

PR Checklist

Tests and Styling

  • Has pytest style unit tests (andpytest passes).
  • IsFlake 8 compliant (installflake8-docstrings and runflake8 --docstring-convention=all).

Documentation

  • [n/a] New features are documented, with examples if plot related.
  • [n/a] New features have an entry indoc/users/next_whats_new/ (follow instructions in README.rst there).
  • [n/a] API changes documented indoc/api/next_api_changes/ (follow instructions in README.rst there).
  • [n/a] Documentation is sphinx and numpydoc compliant (the docs shouldbuild without error).

@ericpreericpre changed the titleFix rotation for aspect ratio of the axes values different from 1Fix rotation selector for aspect ratio of the axes values different from 1Dec 8, 2021
@dstansby
Copy link
Member

This does fix the slow rotation issue for me, but only partially. I can't seem to rotate the selector past +-45 degrees however.

@ericpre
Copy link
MemberAuthor

This does fix the slow rotation issue for me, but only partially. I can't seem to rotate the selector past +-45 degrees however.

The limitation to +-45 degrees rotation is expected to avoid issues with the handle assignment.

@dstansbydstansby added this to thev3.6.0 milestoneDec 10, 2021
@dhomeier
Copy link

Fixes the angle synchronisation for me as well.

The limitation to +-45 degrees rotation is expected to avoid issues with the handle assignment.

Do you recall what specifically happens, or how to reproduce those issues? I could not notice much when removing the 45˚ limit; only when approaching 180˚ the rotation seems to become discontinuous.
I was also wondering how the handle assignments change in comparison when "flipping" the widget by resizing, i.e. set thecenter state and drag the handle past the central point.

@ericpre
Copy link
MemberAuthor

Sorry, I don't know more what I already mentioned in#20839 (comment).

@dhomeier
Copy link

I can confirm your expectation on theself._active_handle – when tracking it e.g. through theonselect function

defonselect(epress,erelease=None):print(tool._active_handle,tool.rotation)

a given corner handle keeps its label through any number of rotations, whereas e.g. inverting the rectangle – click theSW corner and drag it to the opposite position at (20.0, 1.6) withctrl pressed, it remainsSW through this operation, but becomesNE on the next event. So in this case it is obviously possible to update the handle labels, but I haven't found yet if the same could be done forabs(self.rotation) > 45 (which would also need investigation if the angle should then be reset toself.rotation % 45...).
The main practical problem I have found so far is that the resizing becomes more and more unintuitive through the trochoidal reflex motion of the centre handle, though personally I do not find that problematic up to 90˚ angles.

@ericpre
Copy link
MemberAuthor

@dhomeier, is it worth discussing this in a dedicated issue or PR? If not, the discussion will get lost as this PR is not about increasing the rotation limits.

@dhomeier
Copy link

I saw that@dstansby mentioned#21921 as part of an effort to extend the rotation range, but have not found an associated issue for that.

@dstansby
Copy link
Member

Yes, lets move to another issue - I'll open one.

dhomeier reacted with thumbs up emoji

@dstansby
Copy link
Member

I now have a working version ofRectangleSelector that removes the 45 degree limitation, and also fixes scaling using an edge handle when rotated. It needs a bit more work to iron out (and add some more!) tests, but I think it's worth holding off on this for now since it would be redundant with my newer version.

@ericpre
Copy link
MemberAuthor

I now have a working version ofRectangleSelector that removes the 45 degree limitation, and also fixes scaling using an edge handle when rotated. It needs a bit more work to iron out (and add some more!) tests, but I think it's worth holding off on this for now since it would be redundant with my newer version.

Yes, makes sense, I am happy to give an early review, even if this is not finish yet! :)

@jklymak
Copy link
Member

I guess I'm not sure about merging this? Feel free to do so if you think it doesn't need a Whats new entry, and it is consistent with the current state of the docs...

@ericpre
Copy link
MemberAuthor

It makes sense to put this on hold for now, because it will not be necessary after#21945 is merged and#21945 is already in good shape.

dhomeier reacted with thumbs up emoji

@tacaswell
Copy link
Member

Pushing to 3.8 as the last comment suggests waiting for#21945

@ksundenksunden modified the milestones:v3.8.0,future releasesAug 8, 2023
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@jklymakjklymakjklymak approved these changes

@dstansbydstansbydstansby approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
future releases
Development

Successfully merging this pull request may close these issues.

7 participants
@ericpre@dstansby@dhomeier@jklymak@tacaswell@QuLogic@ksunden

[8]ページ先頭

©2009-2025 Movatter.jp