Line mode of RectangleSelector broken or no longer intuitive

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Line mode of RectangleSelector broken or no longer intuitive

Lars Bittrich-2

Dear all,

I recently upgraded to matplotlib 2.0 and found a regression with RectangleSelector with drawtype='line'. A line is no longer draw between start point and end point, but from lower left to upper right of an imaginary rectangle. So you can no longer select a downward slope.

This behavior may have been around for some time and most users will just use RectangleSelector with a rectangle and not a line. There has been a mail on this list regarding the return values only:

http://matplotlib.1069221.n5.nabble.com/widgets-RectangleSelector-return-values-td47623.html

But also the interactive drawing is affected. I looked into the corresponding code and found quite a lot of sorting of x and y values separately. To restore the old behavior one would need many changes to the worse from my point of view.


Please note, that the docstring for RectangleSelector still advertises the ‘line’-mode even if the ‘box’ mode is default now. This example clearly illustrates the problem.

However, I suggest and request for people like me, who want so select a line in a plot to add a LineSelector instead of changing RectangleSelector to the old behavior and maybe break some code for the ‘box’-mode again. This would be much more intuitive for new users.


I added such a LineSelector and attached a patch for widgets.py based on a much reduced copy of RectangleSelector. There still is some code duplicated in the _release method, which could be resolved with a common base class, but would require more changes. Additionally, there are some changes in the docstring of RectangleSelector to use the box-mode and change the print statement to clearly state that start point and end point are no longer returned. In future one could add a deprecation warning and point users to LineSelector if the RectangleSelector is used in line-mode.


Best regards,

Lars


_______________________________________________
Matplotlib-users mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/matplotlib-users

widgets.patch (10K) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Line mode of RectangleSelector broken or no longer intuitive

Paul Hobson-2
Lars,

Thanks for tracking this down and creating a fix. Would you mind submitting a PR? If that's not an option for now, let us know and we'll dig further.
-paul

On Wed, Apr 12, 2017 at 7:47 AM, Lars Bittrich <[hidden email]> wrote:

Dear all,

I recently upgraded to matplotlib 2.0 and found a regression with RectangleSelector with drawtype='line'. A line is no longer draw between start point and end point, but from lower left to upper right of an imaginary rectangle. So you can no longer select a downward slope.

This behavior may have been around for some time and most users will just use RectangleSelector with a rectangle and not a line. There has been a mail on this list regarding the return values only:

http://matplotlib.1069221.n5.nabble.com/widgets-RectangleSelector-return-values-td47623.html

But also the interactive drawing is affected. I looked into the corresponding code and found quite a lot of sorting of x and y values separately. To restore the old behavior one would need many changes to the worse from my point of view.


Please note, that the docstring for RectangleSelector still advertises the ‘line’-mode even if the ‘box’ mode is default now. This example clearly illustrates the problem.

However, I suggest and request for people like me, who want so select a line in a plot to add a LineSelector instead of changing RectangleSelector to the old behavior and maybe break some code for the ‘box’-mode again. This would be much more intuitive for new users.


I added such a LineSelector and attached a patch for widgets.py based on a much reduced copy of RectangleSelector. There still is some code duplicated in the _release method, which could be resolved with a common base class, but would require more changes. Additionally, there are some changes in the docstring of RectangleSelector to use the box-mode and change the print statement to clearly state that start point and end point are no longer returned. In future one could add a deprecation warning and point users to LineSelector if the RectangleSelector is used in line-mode.


Best regards,

Lars


_______________________________________________
Matplotlib-users mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/matplotlib-users



_______________________________________________
Matplotlib-users mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/matplotlib-users
Loading...