Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions doc/api/next_api_changes/deprecations/19221-HS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
``Lasso`` is discouraged
~~~~~~~~~~~~~~~~~~~~~~~~

The use of `.Lasso` is discouraged for new code. Use `.LassoSelector`
instead, which follows the selector-widget interface and remains connected
to the Axes until disconnected.
6 changes: 6 additions & 0 deletions galleries/examples/event_handling/lasso_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
Use a lasso to select a set of points and get the indices of the selected points.
A callback is used to change the color of the selected points.
This example uses the low-level `~matplotlib.widgets.Lasso` widget. For new
code, prefer `~matplotlib.widgets.LassoSelector`, which is shown in the
:doc:`/gallery/widgets/lasso_selector_demo_sgskip` example. `~.LassoSelector`
uses the same interface as the other selector widgets and remains connected
until it is disconnected.
.. note::
This example exercises the interactive capabilities of Matplotlib, and this
will not appear in the static documentation. Please run this code on your
Expand Down
7 changes: 6 additions & 1 deletion galleries/examples/widgets/lasso_selector_demo_sgskip.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,14 @@
Interactively selecting data points with the lasso tool.
This examples plots a scatter plot. You can then select a few points by drawing
This example plots a scatter plot. You can then select a few points by drawing
a lasso loop around the points on the graph. To draw, just click
on the graph, hold, and drag it around the points you need to select.
For most lasso-selection use cases, prefer `~matplotlib.widgets.LassoSelector`
over `~matplotlib.widgets.Lasso`, which is shown in the
:doc:`/gallery/event_handling/lasso_demo` example. `~.LassoSelector` follows
the selector-widget API and stays connected until explicitly disconnected.
"""


Expand Down
8 changes: 7 additions & 1 deletion lib/matplotlib/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -4376,7 +4376,13 @@ def _clear_without_update(self):

class Lasso(AxesWidget):
"""
Selection curve of an arbitrary shape.
[*Discouraged*] Selection curve of an arbitrary shape.
.. admonition:: Discouraged
The use of `Lasso` is discouraged for new code. Use `LassoSelector`
instead, which uses the selector-widget interface and remains
connected to the Axes until disconnected.
The selected path can be used in conjunction with
`~matplotlib.path.Path.contains_point` to select data points from an image.
Expand Down
Loading