Hello,
I'm using the Python igraph bindings and would like to plot my graph
with a transparent background. I think I need to use
igraph.Graph.plot's support for a Cairo surface target. Can anyone
point me at an example of plotting a graph to a cairo surface, or else
is there a better way to do this? The below code snippet shows the
approach I'm trying to get to work. The output image is transparent,
but there's no graph.
Thanks for the library. I've gotten a lot of miles out of it on a wide
variety of network analysis and visualization projects.
Steve
import igraph,cairo
g = igraph.Graph([(0,1), (0,2), (2,3), (3,4), (4,2), (2,5), (5,0),
(6,3), (5,6)])
layout = g.layout('kk')
width,height = 900,600
surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, width, height)
ctx = cairo.Context(surface)
ctx.scale(width,height)
ctx.rectangle(0, 0, 1, 1)
ctx.set_source_rgba(0,0,0,0)
ctx.fill()
igraph.plot(g,surface,bbox=(width,height),layout=layout)
surface.write_to_png('example.png')
_______________________________________________
igraph-help mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/igraph-help