Skip to content

Commit 78798f1

Browse files
committed
Add docstrings for Lasso and LassoSelector.
1 parent fe3e2b8 commit 78798f1

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

lib/matplotlib/widgets.py

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1418,6 +1418,35 @@ def get_active(self):
14181418

14191419

14201420
class LassoSelector(AxesWidget):
1421+
"""Selection curve of an arbitrary shape.
1422+
1423+
The selected path can be used in conjunction with
1424+
:function:`~matplotlib.path.Path.contains_point` to select
1425+
data points from an image.
1426+
1427+
In contrast to :class:`Lasso`, `LassoSelector` is written with an interface
1428+
similar to :class:`RectangleSelector` and :class:`SpanSelector` and will
1429+
continue to interact with the axes until disconnected.
1430+
1431+
Parameters:
1432+
1433+
*ax* : :class:`~matplotlib.axes.Axes`
1434+
The parent axes for the widget.
1435+
*onselect* : function
1436+
Whenever the lasso is released, the `onselect` function is called and
1437+
passed the vertices of the selected path.
1438+
1439+
Example usage::
1440+
1441+
ax = subplot(111)
1442+
ax.plot(x,y)
1443+
1444+
def onselect(verts):
1445+
print verts
1446+
lasso = LassoSelector(ax, onselect)
1447+
1448+
"""
1449+
14211450
def __init__(self, ax, onselect=None, useblit=True, lineprops=None):
14221451
AxesWidget.__init__(self, ax)
14231452

@@ -1482,6 +1511,27 @@ def update_background(self, event):
14821511

14831512

14841513
class Lasso(AxesWidget):
1514+
"""Selection curve of an arbitrary shape.
1515+
1516+
The selected path can be used in conjunction with
1517+
:function:`~matplotlib.path.Path.contains_point` to select
1518+
data points from an image.
1519+
1520+
Unlike :class:`LassoSelector`, this must be initialized with a starting
1521+
point `xy`, and the `Lasso` events are destroyed upon release.
1522+
1523+
Parameters:
1524+
1525+
*ax* : :class:`~matplotlib.axes.Axes`
1526+
The parent axes for the widget.
1527+
*xy* : array
1528+
Coordinates of the start of the lasso.
1529+
*callback* : function
1530+
Whenever the lasso is released, the `callback` function is called and
1531+
passed the vertices of the selected path.
1532+
1533+
"""
1534+
14851535
def __init__(self, ax, xy, callback=None, useblit=True):
14861536
AxesWidget.__init__(self, ax)
14871537

0 commit comments

Comments
 (0)