Hi,
On Mon, Jun 11, 2012 at 10:36 AM, Roey Angel<address@hidden> wrote:
Hi,
I'd like to extract the x y values from an igraph object in order to plot it
in ggplot (which accepts only data frames).
there are not x y values in igraph objects, at least not by default.
Scott Chamberlain has published an attempt to plot igraph networks in ggplot
(http://schamberlain.github.com/2011/03/basic-ggplot2-network-graphs/) but
he's just generating random values for the position of the vertices (through
the vplace variable).
This works fine for small networks but makes a clutter in large networks
and, most importantly, doesn't allow drawing different layouts.
You can generate layout coordinates by using one of the several layout
functions, e.g.
xy<- layout.fruchterman.reingold(mygraph)
The reason I'm insisting on ggplot (apart from the fact that this is what I
know best in R graphics) is because I'd like to have the vertices sized
according to a vector of numeric values and their colours according to a
character vector and that's done very easly in ggplot.
This is actually quite easy without ggplot as well:
G<- graph.ring(10)
plot(G, vertex.size=1:10*2, vertex.color=rainbow(10), layout=layout.circle)
Best,
Gabor
I'm a beginner and trying to figure out my way in the world of networks and
igraph so there might be something very basic I'm missing out here.
Thanks a lot in advance,
Roey
_______________________________________________
igraph-help mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/igraph-help