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
Widgets: RectangleSelector in Mpl 2.1.0 does not behave as described #9608
In Python 3.6.3 and the related matplotlib (just compiled from sources) the RectangleSelector does no longer behave as in Python 2.7 and as is described. Instead of returning the mouse click coordinates in the event variable eclick and the release coordinates in erelease it returns the lower left corner in eclick and the upper right corner in erelease. This "normalization" reduces the information content and, thus, the usability of the selector. Only using the old version a user can switch to drawmode='line' and use the selector to input a displacement vector.
Well, the python3 uses matplotlib 2.1.0 and there the RectangleSelector does not behave like described -- the python2 has matplotlib 1.3.1 installed, where the code reflects the description.
changed the title [-]Widgets: RectangleSelector in 3.6.3 does not behave as described[/-][+]Widgets: RectangleSelector in Mpl 2.1.0 does not behave as described[/+]on Oct 30, 2017
I suspect that this was a consequence of #3937 which went in for 1.5. At a minimum we need to fix the docstring to reflect the current behavior and consider flipping it back or making it configurable. I have a memory of another discussion of this, but can not find it quickly.
I think the normalization of the points made managing the resizing of selection region tractable? attn @blink1073
The normalization was added because you might be dragging one of the handles, or the whole object. It could be improved to preserve the order though so you don't lose information.
OK. I'll see if I can contribute: Make the behaviour for onselect for RectangleSelector match the docstring (again). If you need extents, then you can call that explicitly.
Only using the old version a user can switch to drawmode='line' and use the selector to input a displacement vector.
which was a very clever use of RectangleSelector to get a VectorSelector even if we did not understand that we provided it! @alsast Sorry for not understanding you correctly in 2017.
However, I think that at this point (~4 years later) it is too late to revert the change to RectangleSelector on the risk that we now have users who are relying on the new order. I think the two actions we should take from this issue are
update the documentation of RectangleSelector to make it match what the code does
implement a VectorSelector that is intended from selecting displacement vectors. Now that we have a growing convention around putting handles on the selectors, I think it would make sense to be Line2D with handles on each and and one in the middle.
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
tacaswell commentedon Oct 29, 2017
What version of Matplotlib are you testing? I would be very surprised if this changes is tied to the version of python.
alsast commentedon Oct 30, 2017
Well, the python3 uses matplotlib 2.1.0 and there the RectangleSelector does not behave like described -- the python2 has matplotlib 1.3.1 installed, where the code reflects the description.
[-]Widgets: RectangleSelector in 3.6.3 does not behave as described[/-][+]Widgets: RectangleSelector in Mpl 2.1.0 does not behave as described[/+]tacaswell commentedon Oct 30, 2017
@alsast Sorry we broke this for you.
I suspect that this was a consequence of #3937 which went in for 1.5. At a minimum we need to fix the docstring to reflect the current behavior and consider flipping it back or making it configurable. I have a memory of another discussion of this, but can not find it quickly.
I think the normalization of the points made managing the resizing of selection region tractable? attn @blink1073
blink1073 commentedon Oct 30, 2017
The normalization was added because you might be dragging one of the handles, or the whole object. It could be improved to preserve the order though so you don't lose information.
matplotlib/lib/matplotlib/widgets.py
Lines 2154 to 2163 in 58ec506
blink1073 commentedon Oct 30, 2017
Actually, it isn't just order. What we could do is only normalize if the events aren't both part of the new corner points.
blink1073 commentedon Oct 30, 2017
Or we could revert entirely and you use the extents if you need the true corners.
rowlesmr commentedon Jul 8, 2021
Can the
RectangleSelectorbe made configurable to report eitherextentsor the actual mouse press and release coordinates?If this is a thing that people think is OK, I'll try and figure out how to write a patch for it.
anntzer commentedon Jul 8, 2021
I would rather go with
rather than adding more configurability...
rowlesmr commentedon Jul 8, 2021
OK. I'll see if I can contribute: Make the behaviour for
onselectforRectangleSelectormatch the docstring (again). If you needextents, then you can call that explicitly.rowlesmr commentedon Jul 10, 2021
I've submitted a PR for this issue: #20611
tacaswell commentedon Aug 12, 2021
re-reading this again, I noticed
which was a very clever use of
RectangleSelectorto get aVectorSelectoreven if we did not understand that we provided it! @alsast Sorry for not understanding you correctly in 2017.However, I think that at this point (~4 years later) it is too late to revert the change to
RectangleSelectoron the risk that we now have users who are relying on the new order. I think the two actions we should take from this issue areVectorSelectorthat is intended from selecting displacement vectors. Now that we have a growing convention around putting handles on the selectors, I think it would make sense to be Line2D with handles on each and and one in the middle.github-actions commentedon Apr 22, 2023
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!