igraph-help
[Top][All Lists]
Advanced

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

Re: [igraph] extracting x y values from an igraph object to plot in ggpl


From: Roey Angel
Subject: Re: [igraph] extracting x y values from an igraph object to plot in ggplot
Date: Mon, 11 Jun 2012 17:06:41 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20120430 Thunderbird/12.0.1

Wow thanks for the rapid and very helpful reply, Gabor!
That's all I wanted to know.

Cheers,
Roey

On 06/11/2012 04:43 PM, Gábor Csárdi wrote:
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



Attachment: angel.vcf
Description: Vcard


reply via email to

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