77usable as is). There will be some refinement of the API.
88"""
99from matplotlib .widgets import Lasso
10- import matplotlib .mlab
1110from matplotlib .path import Path
1211from matplotlib .colors import colorConverter
1312from matplotlib .collections import RegularPolyCollection
1413
15- from matplotlib .pyplot import figure , show
14+ import matplotlib .pyplot as plt
1615from numpy import nonzero
1716from numpy .random import rand
1817
19- class Datum :
18+ class Datum ( object ) :
2019 colorin = colorConverter .to_rgba ('red' )
2120 colorout = colorConverter .to_rgba ('blue' )
2221 def __init__ (self , x , y , include = False ):
@@ -26,7 +25,7 @@ def __init__(self, x, y, include=False):
2625 else : self .color = self .colorout
2726
2827
29- class LassoManager :
28+ class LassoManager ( object ) :
3029 def __init__ (self , ax , data ):
3130 self .axes = ax
3231 self .canvas = ax .figure .canvas
@@ -71,8 +70,7 @@ def onpress(self, event):
7170
7271 data = [Datum (* xy ) for xy in rand (100 , 2 )]
7372
74- fig = figure ()
75- ax = fig .add_subplot (111 , xlim = (0 ,1 ), ylim = (0 ,1 ), autoscale_on = False )
73+ ax = plt .axes (xlim = (0 ,1 ), ylim = (0 ,1 ), autoscale_on = False )
7674 lman = LassoManager (ax , data )
7775
78- show ()
76+ plt . show ()
0 commit comments