From: Tim Vieira Date: Mon, 5 Aug 2013 19:42:24 +0000 (-0400) Subject: fix force-directed graph layout example. X-Git-Url: https://hydra-www.ietfng.org/gitweb/?a=commitdiff_plain;h=ab6a6fe132cd5e8fc575dfe91251c2456fca620e;p=dyna2 fix force-directed graph layout example. --- diff --git a/src/Dyna/Backend/Python/post/graph.py b/src/Dyna/Backend/Python/post/graph.py index 79b59ad..eace3c5 100644 --- a/src/Dyna/Backend/Python/post/graph.py +++ b/src/Dyna/Backend/Python/post/graph.py @@ -1,6 +1,7 @@ import pylab as pl from matplotlib.animation import FuncAnimation from collections import defaultdict +from stdlib import topython class graph(object): """ @@ -41,10 +42,10 @@ class graph(object): print 'frame', t, 'missing.' for item in frame[t]: if item.fn == 'line/2': - [(a,b), (c,d)] = item.args + [(a,b), (c,d)] = map(topython, item.args) ax.plot([a,c], [b,d], color='b', alpha=0.5) elif item.fn == 'text/2': - (s,(x,y)) = item.args + (s,(x,y)) = map(topython, item.args) ax.text(x,y,s) else: print 'dont know how to render', item