On Wed, Jul 25, 2012 at 5:11 PM, Scott Henderson <st...@cornell.edu> wrote:

> 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
>

Your changes work fine on my system.

Are you sure the example you wrote above is exactly the same as what you're
running? For example, if I move the `show` out of the function and back
into '__main__', then the lasso stops working (because the lasso manager
gets garbage collected). Otherwise, I can't reproduce the issue. Actually,
what did you mean by "does not work" (e.g., no lasso, error,)?

-Tony
------------------------------------------------------------------------------
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