[Matplotlib-users] Line mode of RectangleSelector broken or no longer intuitive

Paul Hobson pmhobson at gmail.com
Thu Apr 13 10:04:05 EDT 2017


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.

On Wed, Apr 12, 2017 at 7:47 AM, Lars Bittrich <lars.bittrich at gmail.com>

> 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
> Matplotlib-users at python.org
> https://mail.python.org/mailman/listinfo/matplotlib-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20170413/edba85ad/attachment-0001.html>

More information about the Matplotlib-users mailing list