[Matplotlib-users] Line mode of RectangleSelector broken or no longer intuitive
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:
> 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,
> Matplotlib-users mailing list
> Matplotlib-users at python.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Matplotlib-users