I'm trying to develop an application for interactive graph layout using networkx and matplotlib. My idea is to use the usual spring layout, where nodes repel each other and edges act as attractive forces between nodes, but have the layout happen in real time on the screen. The user can also interact with the layout by dragging the nodes and the graph will respond again in real time.
I've worked my way through the interactive and animation examples for matplotlib, which seem fine but I can't figure out how to combine them. What I'd like to get me started is to attach an event listener to the plot in anim.py so I can start and stop it with a mouse or key event. Can anybody point me in the right direction?
Thanks,
Peter
There is an example in the event handling docs called "draggable
rectangle exercise" that shows you how to combine event handling with
animation (see the "extra credit solution")
http://matplotlib.sourceforge.net/doc/html/users/event_handling.html
ยทยทยท
On Thu, Sep 11, 2008 at 10:51 AM, Peter Saffrey <pzs@...2149...> wrote:
I'm trying to develop an application for interactive graph layout using
networkx and matplotlib. My idea is to use the usual spring layout,
where nodes repel each other and edges act as attractive forces between
nodes, but have the layout happen in real time on the screen. The user
can also interact with the layout by dragging the nodes and the graph
will respond again in real time.
I've worked my way through the interactive and animation examples for
matplotlib, which seem fine but I can't figure out how to combine them.
What I'd like to get me started is to attach an event listener to the
plot in anim.py so I can start and stop it with a mouse or key event.
Can anybody point me in the right direction?