interactive plots

Almar Klein almar.klein at gmail.com
Thu Jul 7 00:00:06 CEST 2011


On 6 July 2011 17:04, Mihai Badoiu <mbadoiu at 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)

Regards,
  Almar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20110707/92c17ff7/attachment.html>


More information about the Python-list mailing list