|
From: Scott H. <st...@co...> - 2012-07-25 20:30:29
|
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
|