0

How can I generate a series of images of an evolving graph where the vertices do not move between images? Their positions are supposed to be fixed, and it really messes up the animation when they jitter around.

I'm using the python graph-tool package, following the authors' example for animating a epidemic, but I'm not using the Gtk. Instead I'm creating stills with:

from graph_tool.all import *
...
graph_draw(g, pos, output_size = (500, 400),
        edge_color = [0.6, 0.6, 0.6, 1],
        vertex_fill_color = state,
        vertex_halo = newly_infected,
        vertex_halo_color = [0.8, 0, 0, 0.6],
        output = 'frames/sirs{0:06d}.png'.format(count),
        )
Ian
  • 1,062
  • 1
  • 9
  • 21

1 Answers1

0

Okay, the stupid solution could not be determined from the code snippet I gave. The graph_draw argument fit_view defauls to true, and does the obvious thing. This line from the example:

g.set_vertex_filter(removed, inverted=True)

removes vertecies, so fit_view obtains a different fit for each frame. Take out that filter and the animation is stable.

Ian
  • 1,062
  • 1
  • 9
  • 21