igraph-help
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [igraph] Re: graph drawing using igraph


From: Shrijeet Paliwal
Subject: Re: [igraph] Re: graph drawing using igraph
Date: Tue, 6 Jan 2009 19:20:30 -0500

Thanks Tamas, it worked like a charm. Appreciate all the help.
--
Shrijeet
to iterate is human,to recurse divine.





On Tue, Jan 6, 2009 at 4:53 AM, Tamas Nepusz <address@hidden> wrote:
Hi Shrijeet,


That is one part I might have to play with few other visualizations as well. Please suggest of any other way that strikes you. Also is cairo a better and more agile way of doing this? The pycairo seems to be unavaiable http://www.cairographics.org/pycairo/ hence I couldnt try.
Cairo is the preferred plotting backend for igraph, write_svg is present only for those who are not able to install the Python bindings for Cairo. It looks like there's something wrong with pycairo's homepage at the moment, though :( However, you can download pycairo directly from here which seems to be working:

http://www.cairographics.org/releases/

When you installed pycairo, you can do the following:

colors = ["red", "green", "blue", "yellow"]
cl = your_graph.community_fastgreedy()
your_graph.vs["color"] = [colors[i] for i in cl.membership]
layout = g.layout("kamada_kawai")
plot(your_graph, "figure.svg", layout=layout)

This will plot the graph with the specified vertex colors and save it to figure.svg. You can use any other format that Cairo supports (e.g., PNG or PDF). If you omit the filename, igraph will plot to a temporary file and show it using your platform's default image viewer.

For more complicated plots (e.g., several graphs on the same figure), you will have to create a Plot object, add the objects to be plotted to it and then save it. See help(Graph.__plot__), help(plot) and help(Plot) for more details.

--
Tamas



_______________________________________________
igraph-help mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/igraph-help


reply via email to

[Prev in Thread] Current Thread [Next in Thread]