matplotlib 3.5.1

ParametersBackRef

For the selector to remain responsive you must keep a reference to it.

The selected path can be used in conjunction with ~.Path.contains_point to select data points from an image.

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.

Example usage:

ax = plt.subplot()
ax.plot(x, y)

def onselect(verts):
    print(verts)
lasso = LassoSelector(ax, onselect)

Parameters

ax : `~matplotlib.axes.Axes`

The parent axes for the widget.

onselect : function

Whenever the lasso is released, the onselect function is called and passed the vertices of the selected path.

useblit : bool, default: True

Whether to use blitting for faster drawing (if supported by the backend).

props : dict, optional

Properties with which the line is drawn, see matplotlib.lines.Line2D for valid properties. Default values are defined in mpl.rcParams .

button : `.MouseButton` or list of `.MouseButton`, optional

The mouse buttons used for rectangle selection. Default is None , which corresponds to all buttons.

Selection curve of an arbitrary shape.

Examples

See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

matplotlib.widgets.LassoSelector matplotlib.widgets.Lasso

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


File: /matplotlib/widgets.py#3257
type: <class 'type'>
Commit: