slow plot generation with mplfig

I am using graph-tool to generate an animation. For this I need to use
matplotlib because I should add some extra information to the plot. (see
the attachment). so I first generate a series of plots and then use ffmpeg
to generate my animation. The problem is when I use mplfig and savefig it
takes alot of time to generate my png files. When I simply use output
argument in graph_draw (that means no extra information, only nodes and
edges) it is fast. Is there any solution for this? you can find the
relevant parts of my code in the attachment.

best,

attachment.html (693 Bytes)

p7.png

test.py (1.82 KB)

It seems to me this is just matplotlib being slow... I'm not sure what
can be done about it from graph-tool's side.

Best,
Tiago