igraph-help
[Top][All Lists]
Advanced

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

Re: [igraph] How to make graph with multiple edges on the same plot ?


From: Gábor Csárdi
Subject: Re: [igraph] How to make graph with multiple edges on the same plot ?
Date: Wed, 13 Feb 2013 23:52:46 -0800

Here is what I would try. Combine the two networks in one, and combine the edge labels as well, separated by a \n newline character (probably \\n in R, actually). Then the edge labels will not be on top of each other. 

I am not sure what you can do with multiple edges at this point, because although they might be curved, edge labels are not positioned properly if they are curved. What you could try is plotting the edges with transparency in two different colors, maybe also with different width, and then color the corresponding labels accordingly.This might look good enough. 

The final solution would be to have better edge label positions in igraph, it is on our todo list.

Best,
Gabor


On Tue, Feb 12, 2013 at 6:11 AM, address@hidden <address@hidden> wrote:
Hi,

I have two symmetric matrices with the same dimensions and names of rows and columns, representing two networks.
When there is zero, there is no link, otherwise value indicates link with given weight (strength).

I would like to visualize these two networks on the same plot, because nodes have the same names, they should be combined, but it should be possible to display multiple edges with not overlapping labels (weights). It should be possible to distinguish weights and edges from which network they come from.

As an example I made this simple code


A1 = matrix(rep(0,4*4),ncol=4)
dimnames(A1) = dimnames(A2) = list(letters[1:4],letters[1:4])
A1['c','d'] = A1['d','c'] = rnorm(1)
A1['d','b'] = A1['b','d'] = rnorm(1)
A1['b','a'] = A1['a','b'] = rnorm(1)
igraph.options(print.edge.attributes=T)
g1 = graph.adjacency(A1,mode='undirected',weighted=T)
E(g1)$label = round(E(g1)$weight,3)
plot(g1)

A2 = A1
A2['c','b'] = A2['b','c'] = rnorm(1)
g2 = graph.adjacency(A2,mode='undirected',weighted=T)
E(g2)$label = round(E(g2)$weight,3)
plot(g2)

So basically we have g1 and g2, which I want to plot together, but the edges in g1 and g2 should be treated as multiple edges in new graph with different colors, and also non-overlapping weights as labels (also colored).

Can you help me to solve this ? How to make such a plot ?

Thanks,
Mateusz

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




--
Gabor Csardi <address@hidden>     MTA KFKI RMKI

reply via email to

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