Add interactive matplotlib selector to PolygonPixelRegion#406
Draft
dhomeier wants to merge 3 commits intoastropy:mainfrom
Draft
Add interactive matplotlib selector to PolygonPixelRegion#406dhomeier wants to merge 3 commits intoastropy:mainfrom
PolygonPixelRegion#406dhomeier wants to merge 3 commits intoastropy:mainfrom
Conversation
9f6268f to
605fe44
Compare
Contributor
Author
|
The last commit adds a method to set the rotation angle on a given Polygon instance as |
Member
|
If #500 is merged first, the doc needs to be updated here too. |
605fe44 to
d82b421
Compare
Contributor
Author
|
Status from December 2024 rebased to current main; to proceed further polygon rotation needs to be added to matplotlib, which should probably be done after the corresponding functionality for rectangles and ellipses in matplotlib/matplotlib#26833 has been merged. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
As next part of the work on interactive regions #391 this PR adds an
as_mpl_selectorwidget to thePolygonPixelRegionclass to allow moving and resizing through thedraw_boxfunctionality added toPolygonSelectorin matplotlib/matplotlib#21830, as well as reshaping by direct manipulation of the vertices. Thedraw_boxhandles are working analogously to the selector methods for Rectangle and Ellipse PixelRegions.Rotation is not yet included, but can be added once the mpl PR or a follow-up supports this. A
centroidmethod is already included to provide a robust and rotation-invariant reference point.The connected
PolygonSelectorisinstantiated in a rather pedestrian manner, using several private methods, which should perhaps be replaced by a public method on the matplotlib side.using the newverts.settermethod for updating the vertices; tiny remaining quirk is the bounding box not being displayed after creation, but only after the first event inside.