Hello, I'm trying to incorporate some matplotlib widgets into my scripts 
that generate plots. I'm unsure why, but if I wrap the figure creation 
lines in lasso_demo.py with a function the demo does not work. Why?

#Original:
#------------
if __name__ == '__main__':
     data = [Datum(*xy) for xy in randn(100,2)]
     fig = figure()
     ax = fig.add_subplot(111, xlim=(0,1), ylim=(0,1), autoscale_on=False)
     lman = LassoManager(ax, data)
     show()

#Change:
#------------
def run(points):
     data = [Datum(*xy) for xy in points]
     fig = figure()
     ax = fig.add_subplot(111, xlim=(0,1), ylim=(0,1), autoscale_on=False)
     lman = LassoManager(ax, data)
     show()

if __name__ == '__main__':
     points = rand(100, 2)
     run(points)


-- 
---------------
Scott T. Henderson
http://www.geo.cornell.edu/eas/gstudent/sth54/contact.html


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to