René's URL Explorer Experiment


Title: [ENH]: Add OrientedRectangleSelector (interactive rotated rectangle selector) · Issue #30442 · matplotlib/matplotlib · GitHub

Open Graph Title: [ENH]: Add OrientedRectangleSelector (interactive rotated rectangle selector) · Issue #30442 · matplotlib/matplotlib

X Title: [ENH]: Add OrientedRectangleSelector (interactive rotated rectangle selector) · Issue #30442 · matplotlib/matplotlib

Description: Problem Matplotlib’s current RectangleSelector only supports axis-aligned rectangles. Many domains (image annotation, computer vision, OCR, remote sensing, microscopy, UI layout tools) need oriented/rotated bounding boxes with interactiv...

Open Graph Description: Problem Matplotlib’s current RectangleSelector only supports axis-aligned rectangles. Many domains (image annotation, computer vision, OCR, remote sensing, microscopy, UI layout tools) need oriente...

X Description: Problem Matplotlib’s current RectangleSelector only supports axis-aligned rectangles. Many domains (image annotation, computer vision, OCR, remote sensing, microscopy, UI layout tools) need oriente...

Opengraph URL: https://github.com/matplotlib/matplotlib/issues/30442

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[ENH]: Add OrientedRectangleSelector (interactive rotated rectangle selector)","articleBody":"### Problem\n\nMatplotlib’s current `RectangleSelector` only supports axis-aligned rectangles. Many domains (image annotation, computer vision, OCR, remote sensing, microscopy, UI layout tools) need **oriented/rotated bounding boxes** with interactive **resize/rotate/translate**. Today, users hack around this with `PolygonSelector` (4 points) or custom event handlers, which leads to inconsistent UX, no angle snapping, and a lot of duplicated code.\n\n\n### Proposed solution\n\n\nIntroduce a new widget: **`OrientedRectangleSelector`**, an interactive selector that behaves like `RectangleSelector` but supports **arbitrary rotation**. It provides:\n\n* Corner and edge handles for resizing (with optional aspect-ratio lock).\n* A rotation handle with optional **angle snapping**.\n* Dragging the center to translate.\n* Live callbacks during interaction and a final `onselect` on release.\n* Visual feedback (cursors, handles) and optional blitting for performance.\n\nThis mirrors the mental model of `RectangleSelector` while adding rotation.\n\n### High-level API\n\n```python\nfrom matplotlib.widgets import OrientedRectangleSelector\n\nors = OrientedRectangleSelector(\n    ax,\n    onselect=None,              # called on mouse release with final params\n    onmove_callback=None,       # called during interaction with live params\n    *,\n    useblit=False,\n    button=None,\n    minspanx=0, minspany=0,\n    spancoords=\"data\",\n    maxdist=10,                 # handle hit test (px)\n    snap_angle=True,\n    angle_snap_increment=1.0,   # degrees\n    maintain_aspect_ratio=False,\n    min_size=0.02,              # in data units\n    initial_center=(0.5, 0.5),\n    initial_width=0.3,\n    initial_height=0.2,\n    initial_angle=0.0,          # degrees\n    handle_props=None,          # dict for corner/edge/rotate/center styles\n    line_props=None,            # rectangle edge props\n    state_modifier_keys=None,   # {'rotate': 'shift', 'aspect_ratio': 'control', 'snap': 'alt'}\n)\n```\n\n**Returned/Callback params**\n\n```python\n{\n    \"center\": np.ndarray([cx, cy]),\n    \"width\": float,\n    \"height\": float,\n    \"angle\": float,             # degrees\n    \"corners\": np.ndarray(shape=(4,2)),  # BL, BR, TR, TL in data coords\n    \"area\": float\n}\n```\n\n**Programmatic control**\n\n```python\nors.set_rectangle(center=(x, y), width=w, height=h, angle=a)\nparams = ors.get_rectangle_params()\nors.update_properties({\"snap_angle\": False, \"min_size\": 0.05})\n```\n\n### Example usage\n\n```python\nfig, ax = plt.subplots()\nax.imshow(img, cmap=\"gray\")\n\ndef onmove(params):\n    # live feedback (e.g., show crop/metrics)\n    pass\n\ndef ondone(params):\n    print(params[\"center\"], params[\"width\"], params[\"height\"], params[\"angle\"])\n\nors = OrientedRectangleSelector(ax, onselect=ondone, onmove_callback=onmove,\n                                snap_angle=True, angle_snap_increment=1.0)\nplt.show()\n```\n\n### UX details\n\n* **Handles**: 4 corners, 4 edge midpoints, 1 rotation handle, 1 center “+”.\n* **Cursors**: move/resize/rotate cursors based on hover target.\n* **Snapping**: configurable granularity (default 1°; can be 15° etc.).\n* **Constraints**: configurable minimum size; easy to add “keep inside axes” later.\n\n\u003cimg width=\"1920\" height=\"1040\" alt=\"Image\" src=\"https://github.com/user-attachments/assets/600a473e-34fe-414f-8549-ceda6dca43d9\" /\u003e\n\n### Implementation notes\n\nA reference implementation is attached (ready to adapt to Matplotlib conventions):\n\n* Uses a `Rectangle` patch drawn at the origin and transformed via `Affine2D` (rotate + translate) for numerical stability.\n* Hit-testing in data space; handle detection uses pixel tolerance.\n* Optional blitting for smooth interaction.\n* Clean separation of interaction modes: translate, rotate, resize-corner, resize-edge.\n* Public methods mirror `RectangleSelector` where possible; extras are additive.\n\n### Backward compatibility\n\nNo breakage. New widget, opt-in. Naming follows `RectangleSelector`. Consider adding an alias `RotatedRectangleSelector` for searchability.\n\n### Performance\n\nBlitting support keeps interaction smooth; complexity is similar to existing selectors. Handle count is fixed (small); transform math is minimal.\n\n### Testing\n\n* Unit tests for:\n  * Local↔world transform correctness.\n  * Angle snapping correctness.\n  * Aspect-ratio lock.\n  * Min-size constraint.\n* Image tests for handle placement and rotation rendering.\n* Event simulation tests (press/motion/release) to validate callbacks.\n\n### Documentation\n\n* User guide with interactive examples.\n* API reference with detailed parameter descriptions.\n* Changelog for version updates.\n\n[I am ready to do that!]\n\n### Future extensions (non-blocking)\n\n* Constrain rectangle within axes/view limits.\n* Keyboard nudging \u0026 precise numeric entry.\n* Multi-rectangle manager as a helper (selection, add/remove).\n* Snapping to guide lines / other artists.\n\n\n\u003e Note: I have more ideas for this widget and ready to take full ownership and I can implement them.","author":{"url":"https://github.com/saranmahadev","@type":"Person","name":"saranmahadev"},"datePublished":"2025-08-19T08:01:19.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/30442/matplotlib/issues/30442"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:a314b40a-4742-d8ab-af7e-13be45e71abe
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idB04E:43AB7:2A5D031:39DEC13:6A544B2B
html-safe-nonce993de8b4f775beb6254f521bbc9d5274e66cef0c80e01547dc9c88b561d31375
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMDRFOjQzQUI3OjJBNUQwMzE6MzlERUMxMzo2QTU0NEIyQiIsInZpc2l0b3JfaWQiOiI0NDcxMDY1ODU3NDc3NTkzODk5IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac3c3464588a5314ccde38ba5b9a24449f012cf2d9521daa537560a265b4f31bb1
hovercard-subject-tagissue:3333351146
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/matplotlib/matplotlib/30442/issue_layout
twitter:imagehttps://opengraph.githubassets.com/e0d0a7a916e524df527c8911335a1f9ce9d5ed13cd726d12c507fb3a205c9380/matplotlib/matplotlib/issues/30442
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/e0d0a7a916e524df527c8911335a1f9ce9d5ed13cd726d12c507fb3a205c9380/matplotlib/matplotlib/issues/30442
og:image:altProblem Matplotlib’s current RectangleSelector only supports axis-aligned rectangles. Many domains (image annotation, computer vision, OCR, remote sensing, microscopy, UI layout tools) need oriente...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamesaranmahadev
hostnamegithub.com
expected-hostnamegithub.com
Noneb9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb
turbo-cache-controlno-preview
go-importgithub.com/matplotlib/matplotlib git https://github.com/matplotlib/matplotlib.git
octolytics-dimension-user_id215947
octolytics-dimension-user_loginmatplotlib
octolytics-dimension-repository_id1385122
octolytics-dimension-repository_nwomatplotlib/matplotlib
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id1385122
octolytics-dimension-repository_network_root_nwomatplotlib/matplotlib
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release07a982c1d40157c619b364352b704c3ce66bb332
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/matplotlib/matplotlib/issues/30442#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmatplotlib%2Fmatplotlib%2Fissues%2F30442
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmatplotlib%2Fmatplotlib%2Fissues%2F30442
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=matplotlib%2Fmatplotlib
Reloadhttps://github.com/matplotlib/matplotlib/issues/30442
Reloadhttps://github.com/matplotlib/matplotlib/issues/30442
Reloadhttps://github.com/matplotlib/matplotlib/issues/30442
Please reload this pagehttps://github.com/matplotlib/matplotlib/issues/30442
matplotlib https://github.com/matplotlib
matplotlibhttps://github.com/matplotlib/matplotlib
Please reload this pagehttps://github.com/matplotlib/matplotlib/issues/30442
Notifications https://github.com/login?return_to=%2Fmatplotlib%2Fmatplotlib
Fork 8.4k https://github.com/login?return_to=%2Fmatplotlib%2Fmatplotlib
Star 23k https://github.com/login?return_to=%2Fmatplotlib%2Fmatplotlib
Code https://github.com/matplotlib/matplotlib
Issues 1.1k https://github.com/matplotlib/matplotlib/issues
Pull requests 408 https://github.com/matplotlib/matplotlib/pulls
Actions https://github.com/matplotlib/matplotlib/actions
Projects https://github.com/matplotlib/matplotlib/projects
Wiki https://github.com/matplotlib/matplotlib/wiki
Security and quality 0 https://github.com/matplotlib/matplotlib/security
Insights https://github.com/matplotlib/matplotlib/pulse
Code https://github.com/matplotlib/matplotlib
Issues https://github.com/matplotlib/matplotlib/issues
Pull requests https://github.com/matplotlib/matplotlib/pulls
Actions https://github.com/matplotlib/matplotlib/actions
Projects https://github.com/matplotlib/matplotlib/projects
Wiki https://github.com/matplotlib/matplotlib/wiki
Security and quality https://github.com/matplotlib/matplotlib/security
Insights https://github.com/matplotlib/matplotlib/pulse
[ENH]: Add OrientedRectangleSelector (interactive rotated rectangle selector)https://github.com/matplotlib/matplotlib/issues/30442#top
New featurehttps://github.com/matplotlib/matplotlib/issues?q=state%3Aopen%20label%3A%22New%20feature%22
topic: widgets/UIhttps://github.com/matplotlib/matplotlib/issues?q=state%3Aopen%20label%3A%22topic%3A%20widgets%2FUI%22
https://github.com/saranmahadev
saranmahadevhttps://github.com/saranmahadev
on Aug 19, 2025https://github.com/matplotlib/matplotlib/issues/30442#issue-3333351146
https://private-user-images.githubusercontent.com/60286874/479401200-600a473e-34fe-414f-8549-ceda6dca43d9.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3ODM5MDk0NjMsIm5iZiI6MTc4MzkwOTE2MywicGF0aCI6Ii82MDI4Njg3NC80Nzk0MDEyMDAtNjAwYTQ3M2UtMzRmZS00MTRmLTg1NDktY2VkYTZkY2E0M2Q5LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjA3MTMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYwNzEzVDAyMTkyM1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTg3YjE3YzY0YTA4NDA2MDI4MDQ1ZmEzZjNlZWI1MjM3ZDMzZmEwNGRkMWJiNjMyODgzNjE2MDBiYTRlZjJjZmQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JnJlc3BvbnNlLWNvbnRlbnQtdHlwZT1pbWFnZSUyRnBuZyJ9.xo58ZczqVs0p0ABzz2LjVOC3zQ7A4DQcR9at5mKTUrw
New featurehttps://github.com/matplotlib/matplotlib/issues?q=state%3Aopen%20label%3A%22New%20feature%22
topic: widgets/UIhttps://github.com/matplotlib/matplotlib/issues?q=state%3Aopen%20label%3A%22topic%3A%20widgets%2FUI%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.