Skip to content

Clarify Lasso[Selector] demos #19221

Open

Description

@ianhi

Problem

It is not easy to figure out the differences between the Lasso Demo and the Lasso Selector Demo. There is some redundancy between them

The Lasso Demo explanation contains this off putting sentence:

This is currently a proof-of-concept implementation (though it is usable as is). There will be some refinement of the API.

Furthermore, despite both Lasso and LassoSelector being in widgets.py the Lasso Demo is under the Event Handling sections of the gallery - which I find confusing.

https://matplotlib.org/3.3.2/gallery/widgets/lasso_selector_demo_sgskip.html and It not eas

Suggested Improvements

  1. Move Lasso Demo under the widgets examples
  2. remove the sentence about proof of concept implementation from Lasso Demo.
  3. Add a recommendation (and link to demo) to use LassoSelector for selecting points to the explanatory paragraph in Lasso Demo
    • Both examples should probably cross reference eachother actually
  4. Create an example showcasing the difference between Lasso and LassoSelector (After a cursory read I don't see why I wouldn't always prefer the latter)

Matplotlib version

  • Matplotlib documentation version: devdocs/3.3.3

Activity

  1. ianhi commented on Jan 3, 2021

    @ianhi
    ContributorAuthor

    This is currently a proof-of-concept implementation (though it is usable as is). There will be some refinement of the API.

    Turns out this comment was added 15 years ago:
    https://github.com/matplotlib/matplotlib/blame/7a0d65666ee9e73736500eddd20d65acafb86a65/examples/event_handling/lasso_demo.py#L10

    at which point I have no doubt that it was a true statement. However, the api does seem to have solidified in the intervening years. Also in this rooting around through history it seems that LassoSelector was added (#730) several years after the initial Lasso implementation, is it always to be preferred?

  2. timhoffm commented on Jan 4, 2021

    @timhoffm
    Member

    Unfortunately, widgets are not very actively maintained. Without looking into the details, it may well be Lasso is superseded by LassoSelector. At least the limiting note in the Lasso example and the fact that the younger LassoSelector is more in line with the other selectors would make it plausible that LassoSelector was intended as a replacement. Unfortunately #730 is not explicit about it. Ping @efiring who merged #730: Do you remember anything about this?

  3. ianhi commented on Jan 4, 2021

    @ianhi
    ContributorAuthor

    Is this also a good first issue? Assuming my proposed changes are desireable some of them are low barrier to entry.

  4. timhoffm commented on Jan 4, 2021

    @timhoffm
    Member

    The difficult part is to decide what should be done. Once that's done it's possibly less work to directly do it than to write up what to do in a newcomer-friendly way. It's mostly getting the right wording in the right places.

  5. ianhi commented on Feb 14, 2023

    @ianhi
    ContributorAuthor

    Looking at this again due to #25155 and I now believe that Lasso should be deprecated in favor of LassoSelector

  6. github-actions commented on Apr 13, 2026

    @github-actions

    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!

  7. timhoffm commented on Apr 15, 2026

    @timhoffm
    Member

    I still have difficulty to understand the differences and would be happy to get rid of one. @ianhi can you explain why Lasso should be deprecated and whether LassoSelector is the right choice?

  8. ianhi commented on Apr 15, 2026

    @ianhi
    ContributorAuthor

    (After a cursory read I don't see why I wouldn't always prefer the latter)

    I wish I had explained myself 😞 . I don't know why I said that. Bbut agree that going to just one would be good. I guess I preferred LassoSelector because there were bugs in Lasso at that time or simply because it was newer?

  9. ianhi commented on Apr 15, 2026

    @ianhi
    ContributorAuthor

    Ok actually I do see. If you read the docstrings the advantage of LassoSelector starts to emerge

    Lasso:

    Unlike LassoSelector, this must be initialized with a starting point xy, and the Lasso events are destroyed upon release.

    Init with a starting point is pretty confusing

    and the LassoSelector

    In contrast to Lasso, LassoSelector is written with an interface similar to RectangleSelector and SpanSelector, and will continue to interact with the Axes until disconnected.

    consistency among selectors seems like a real positive

  10. timhoffm commented on Apr 22, 2026

    @timhoffm
    Member
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions