You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[ENH]: Remove +/- 45deg restriction on rotating RectangleSelector #21937
There's currently a restriction to +/- 45deg for rotating a RectangleSelector. See #20839 (comment) and #20839 (comment) for some previous discussion/context.
I think it is technically possible to remove this restriction, and am currently looking into it.
See also #21886 (comment) for discussion of the "correct" assignment of handle labels.
Put it somewhat differently, to what extent should an "original" version of a shape be preserved? For Rectangle/Ellipse any rotation can already be effected by its angle modulo 90˚plus possibly swapping long and short axes, so self.rotation could remain restricted to that range (or equivalently ±45˚), and width/height be exchanged as required. I am still in favour of allowing larger rotation angle changes in one event, just the properties would be updated afterwards.
Somewhat related, when rotation support for PolygonSelector is added at some point, a rotated polygon can always be substituted by another polygon with rotated vertices, so that case might be implemented without bothering to ever keep track of the rotation angle.
I've just spend a little time working on this, so thought I would share my approach. I think the fundamental limitation is that RectangleSelector is implemented in data coordinates, whereas selectors really work in display coordinates. When we rotate a selector, we want the rotation to happen in display space, not data space.
So I'm working to change RectangleSelector to be defined in display space. This is going to be a major change, but will make operations like scaling and rotating much easier by applying them in the native display coordinates that the user is interacting with.
This issue has been marked "inactive" because it has been 365 days since the last comment. If this issue is still present in recent Matplotlib releases, or the feature request is still wanted, please leave a comment and this label will be removed. If there are no updates in another 30 days, this issue will be automatically closed, but you are free to re-open or create a new issue if needed. We value issue reports, and this procedure is meant to help us resurface and prioritize issues that have not been addressed yet, not make them disappear. Thanks for your help!
Activity
dhomeier commentedon Dec 13, 2021
See also #21886 (comment) for discussion of the "correct" assignment of handle labels.
Put it somewhat differently, to what extent should an "original" version of a shape be preserved? For Rectangle/Ellipse any rotation can already be effected by its angle modulo 90˚plus possibly swapping long and short axes, so
self.rotationcould remain restricted to that range (or equivalently ±45˚), and width/height be exchanged as required. I am still in favour of allowing larger rotation angle changes in one event, just the properties would be updated afterwards.Somewhat related, when rotation support for
PolygonSelectoris added at some point, a rotated polygon can always be substituted by another polygon with rotated vertices, so that case might be implemented without bothering to ever keep track of the rotation angle.dstansby commentedon Dec 13, 2021
I've just spend a little time working on this, so thought I would share my approach. I think the fundamental limitation is that
RectangleSelectoris implemented in data coordinates, whereas selectors really work in display coordinates. When we rotate a selector, we want the rotation to happen in display space, not data space.So I'm working to change
RectangleSelectorto be defined in display space. This is going to be a major change, but will make operations like scaling and rotating much easier by applying them in the native display coordinates that the user is interacting with.github-actions commentedon Nov 14, 2025
This issue has been marked "inactive" because it has been 365 days since the last comment. If this issue is still present in recent Matplotlib releases, or the feature request is still wanted, please leave a comment and this label will be removed. If there are no updates in another 30 days, this issue will be automatically closed, but you are free to re-open or create a new issue if needed. We value issue reports, and this procedure is meant to help us resurface and prioritize issues that have not been addressed yet, not make them disappear. Thanks for your help!
timhoffm commentedon Nov 14, 2025
#26833 will address this.