]> hydra-www.ietfng.org Git - dyna2/commitdiff
fix force-directed graph layout example.
authorTim Vieira <tim.f.vieira@gmail.com>
Mon, 5 Aug 2013 19:42:24 +0000 (15:42 -0400)
committerTim Vieira <tim.f.vieira@gmail.com>
Mon, 5 Aug 2013 19:42:24 +0000 (15:42 -0400)
src/Dyna/Backend/Python/post/graph.py

index 79b59ad6b9059d8564b49ef86d93e644b7cc19c1..eace3c5d54cfada77e7b6a6d2a9d292a78476083 100644 (file)
@@ -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