igraph-help
[Top][All Lists]
Advanced

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

Re: [igraph] How to optimise layout without 'area' option?


From: Mostowy, Rafal J
Subject: Re: [igraph] How to optimise layout without 'area' option?
Date: Mon, 7 Mar 2016 12:20:28 +0000

Hi Tamas,

Thanks a lot for your reply. This sounds like a y complicated solution of the 
problem. I'm saying this because before I would just vary one parameter and get 
the result I wanted, whereas now I'd need to design an entire function to merge 
the connected components. Is there a simple way of doing that? Would you be 
willing to give a simple exaple? The one on the help page doesn't seem to do 
what I need. 

Thanks a lot,
R

> On 5 Mar 2016, at 20:48, Tamas Nepusz <address@hidden> wrote:
> 
> Hi,
> 
> The new implementation of the Fruchterman-Reingold layout does not
> have the "area" option any more, but you can try using
> layout_components() - this will decompose the graph into connected
> components first, lay out the connected components separately, and
> then merge the layouts.
> 
> T.
> 
> 
> On Sat, Mar 5, 2016 at 2:56 PM, Mostowy, Rafal J
> <address@hidden> wrote:
>> I'm trying to optimise the layout of a network I'm constructing with the 
>> following code:
>> 
>> gr <- read.table("data.txt", header = F, stringsAsFactors = F)
>> node.names <- gr[,1]
>> node.names <- toupper(substr(node.names, 2, nchar(node.names)))
>> gr <- gr[,-1]
>> edge.table.index <- which(gr>0.5, arr.ind=T)
>> d <- data.frame(first = node.names[edge.table.index[,1]], second = 
>> node.names[edge.table.index[,2]])
>> g <- graph.data.frame(d, directed=F)
>> g[from=V(g), to=V(g)] <- 0
>> layout.g <- layout.fruchterman.reingold(g)
>> plot(g, layout = layout.g, vertex.size = 5, vertex.label.cex=.7, 
>> vertex.color = "lightblue", vertex.label.family = "sans", 
>> edge.color="black", vertex.frame.color= "white")
>> 
>> In particular, what I'm trying to do is decrease the area on which the nodes 
>> are displayed such that the connected components are closer together. 
>> Previous versions of igraph had the option 'area' in the 
>> layout.fruchterman.reingold() function but this doesn't seem to be the case 
>> anymore. I've tried playing with various options like vertex size, vertex 
>> font size and width/height of the exported pdf file but they don't really do 
>> the trick.
>> 
>> Does anyone have a suggestion? I’m attaching a link to the data.
>> 
>> Thanks,
>> Rafal
>> 
>> 
>> 
>> 
>> 
>> ________________
>> Rafal Mostowy, PhD
>> Junior Research Fellow
>> Department of Infectious Disease Epidemiology
>> Imperial College London
>> St Mary's Campus
>> Norfolk Place
>> London W2 1PG
>> email: address@hidden
>> twitter: @RafalMostowy
>> website: http://rmostowy.wordpress.com
>> 
>> 
>> 
>> _______________________________________________
>> igraph-help mailing list
>> address@hidden
>> https://lists.nongnu.org/mailman/listinfo/igraph-help
> 
> _______________________________________________
> igraph-help mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/igraph-help



reply via email to

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