On 7 July 2011 00:00, Almar Klein <almar.kl...@gmail.com> wrote: > > > On 6 July 2011 17:04, Mihai Badoiu <mbad...@gmail.com> wrote: > >> How do I do interactive plots in python? Say I have to plot f(x) and g(x) >> and I want in the plot to be able to click on f and make it disappear. Any >> python library that does this? > > > Visvis is a plotting toolkit that has good support for interactive use and > picking: http://code.google.com/p/visvis/ > > I'll even give you an example: > > import visvis as vv > > > # Create to lines, increase line width (lw) for easier clicking > > f = vv.plot([1,2,3,2], lc='r', lw=3) > > g = vv.plot([2,1,4,3], lc='b', lw=3) > > > # Create callback function > > def deleteLine(event): > > event.owner.Destroy() > > # Enable picking and set callback > > for fg in [f, g]: > > fg.hitTest = True > > fg.eventMouseDown.Bind(deleteLine) >
Except that the indentation got mangled when I pasted the code in. Sorry about that. Almar
-- http://mail.python.org/mailman/listinfo/python-list