@@ -1418,6 +1418,35 @@ def get_active(self):
1418
1418
1419
1419
1420
1420
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
+
1421
1450
def __init__ (self , ax , onselect = None , useblit = True , lineprops = None ):
1422
1451
AxesWidget .__init__ (self , ax )
1423
1452
@@ -1482,6 +1511,27 @@ def update_background(self, event):
1482
1511
1483
1512
1484
1513
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
+
1485
1535
def __init__ (self , ax , xy , callback = None , useblit = True ):
1486
1536
AxesWidget .__init__ (self , ax )
1487
1537
0 commit comments