I'm setting about to use a python package named graph-tool to visualize graphs. For some reason it sets grey background color each time saving a graph, which looks far from pleasant. Anyone knows how to change it to white?
For example, this sample code:
from graph_tool.all import *
g = price_network(5000)
p = sfdp_layout(g)
graph_draw(g, pos=p, output="example.png")
being run on iPython notebook, displays graph with white background on the screen, but saved picture has grey background.
The outcome is the same whatever format is used for output (at least with .png, .pdf and .svg). With networkX there was no such a problem, but graph drawing there is slower and much less flexible.
Thanks for any help!
You should just pass the bg_color
option to graph_draw(). For example:
graph_draw(g, pos=p, bg_color=[1,1,1,1], output="example.png")
will produce a white background, instead of transparent.