igraph-help
[Top][All Lists]
Advanced

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

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


From: address@hidden
Subject: [igraph] How to make graph with multiple edges on the same plot ?
Date: Tue, 12 Feb 2013 15:11:42 +0100

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

reply via email to

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