[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [igraph] Re: graph drawing using igraph
From: |
Tamas Nepusz |
Subject: |
Re: [igraph] Re: graph drawing using igraph |
Date: |
Tue, 6 Jan 2009 09:53:52 +0000 |
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