matplotlib.widgets.LassoSelector#
- class matplotlib.widgets.LassoSelector(ax, onselect=None, *, useblit=True, props=None, button=None)[source]#
Bases:
_SelectorWidgetSelection curve of an arbitrary shape.
For the selector to remain responsive you must keep a reference to it.
The selected path can be used in conjunction with
contains_pointto select data points from an image.In contrast to
Lasso,LassoSelectoris written with an interface similar toRectangleSelectorandSpanSelector, and will continue to interact with the Axes until disconnected.Example usage:
ax = plt.subplot() ax.plot(x, y) def onselect(verts): print(verts) lasso = LassoSelector(ax, onselect)
- Parameters:
- ax
Axes The parent Axes for the widget.
- onselectfunction, optional
Whenever the lasso is released, the onselect function is called and passed the vertices of the selected path.
- useblitbool, default: True
Whether to use blitting for faster drawing (if supported by the backend). See the tutorial Faster rendering by using blitting for details.
- propsdict, optional
Properties with which the line is drawn, see
Line2Dfor valid properties. Default values are defined inmpl.rcParams.- button
MouseButtonor list ofMouseButton, optional The mouse buttons used for rectangle selection. Default is
None, which corresponds to all buttons.
- ax