|
From: | Sebastián Goinheix |
Subject: | Re: [igraph] Node Overlap and Positioning |
Date: | Thu, 30 Nov 2017 10:33:04 -0300 |
LorenzoCheersAny suggestion is appreciated.To fix the ideas, please have a look at the self contained example at the end of the email.For 3), yes, I can bend the edges, but the result is not nearly as smooth as in that network visualization.For 2), what is the recommended layout?As to 1), from my googling, it appears that igraph has no concept of node size, so you have to fine tune the layout, xlim,ylim and node size yourself. Or has anything changed at this regard?3) the edges are curved in a very smooth way.2) the bigger nodes have a rather central position in the network plot1) there is no overlapping between the nodesI like it becausewhere if you scroll down a bit you find a nice visualization.Please have a look atEssentially, I would like to make a nice eye-catching plot of a simple network.Dear All,I have not used the igraph in a long time, so I am a bit rusty.
https://ged-project.de/research/studies/factory- europe/
##########################################################
library(igraph)
g <- structure(list(28, FALSE, c(6, 6, 8, 9, 10, 10, 11, 12, 13, 14,
15, 16, 16, 17, 17, 17, 17, 17, 17, 18, 18, 19, 19, 19, 20, 20,
20, 20, 20, 20, 21, 21, 21, 22, 22, 22, 23, 23, 23, 24, 24, 24,
25, 25, 25, 25, 25, 25, 26, 26, 26, 27, 27, 27), c(1, 2, 2, 3,
2, 7, 6, 1, 4, 10, 2, 1, 12, 1, 3, 5, 6, 10, 13, 7, 15, 14, 17,
18, 0, 1, 2, 14, 18, 19, 0, 6, 7, 0, 9, 18, 17, 20, 22, 5, 7,
11, 0, 8, 10, 18, 22, 24, 6, 9, 14, 4, 21, 25), c(0, 1, 2, 3,
4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
53), c(24, 30, 33, 42, 0, 7, 11, 13, 25, 1, 2, 4, 10, 26, 3,
14, 8, 51, 15, 39, 6, 16, 31, 48, 5, 19, 32, 40, 43, 34, 49,
9, 17, 44, 41, 12, 18, 21, 27, 50, 20, 22, 36, 23, 28, 35, 45,
29, 37, 52, 38, 46, 47, 53), c(0, 0, 0, 0, 0, 0, 0, 2, 2, 3,
4, 6, 7, 8, 9, 10, 11, 13, 19, 21, 24, 30, 33, 36, 39, 42, 48,
51, 54), c(0, 4, 9, 14, 16, 18, 20, 24, 28, 29, 31, 34, 35, 36,
37, 40, 41, 41, 43, 47, 48, 49, 50, 52, 52, 53, 54, 54, 54),
list(c(1, 0, 1), structure(list(name = "Erdos renyi (gnp) graph",
type = "gnp", loops = FALSE, p = 0.142857142857143), .Names = c("name",
"type", "loops", "p")), structure(list(names = c("BE", "BG",
"CZ", "DK", "DE", "EE", "IE", "EL", "ES", "FR", "IT", "CY",
"LV", "LT", "LU", "HU", "MT", "NL", "AT", "PL", "PT", "RO",
"SI", "SK", "FI", "SE", "UK", "HR")), .Names = "names"),
structure(list(weight = c(16.3104184714332, 30.7293642773093,
1.51651715633125, 46.5498389394643, 117.400128622748,
9116.96298628885, 1101.62292417749, 12.3449820775232,
158.642126867059, 1.81516408646891, 760.982895191571,
1011.05564809154, 31677.1638228568, 189.344972592696,
13.1424122833109, 66.5517926330624, 12.0922729908787,
4.58139821481045, 90.1042955878783, 3.71064650396136,
90.4281997569113, 158.365362288124, 46.6972207187443,
30.3317841283049, 7.78960961626955, 1.95560245248322,
697.72330148994, 58.3866681241721, 660.780592399842,
1.30621866244087, 90.6566452600129, 411.372413931909,
50.4594917412583, 30.747955195432, 5.22931377396076,
26225.4597289607, 518.792688616195, 12998.9635603034,
69.4202716300456, 8.21344218621299, 0.582827301648975,
8.09867531337074, 107.652085596974, 1142.61073604216,
116.541846414264, 1.62280326041373, 405.914678311703,
0.386623934247936, 18.218603738158, 21.1501080346551,
0.158066706508139, 862.791072359265, 8.42653129127126,
20.0432021225717)), .Names = "weight"))), class = "igraph")
g <- upgrade_graph(g)
## l <- layout.fruchterman.reingold(g)
l <- layout_with_dh(g)
l <- layout.norm(l, -1,1, -1,1)
l <- norm_coords(layout.graphopt(g), xmin=-2, xmax=2, ymin=-2, ymax=2)
set.seed(1234)
pdf("toy-network.pdf")
plot(g, layout=l,
## rescale=F, ylim=c(0.4,2.6), xlim=c(-3.4, -1.7),
## vertex.label.dist=0.5,
vertex.color=adjustcolor("blue", .5),
vertex.frame.color="#ff000033",
edge.color="#55555533",
vertex.label=V(g)$names,
vertex.label.color="black",
vertex.size=log(strength(g))*2,
edge.width= log(1+E(g)$weight)
, edge.curved=0.3,
edge.label=NA )
dev.off()
_______________________________________________
igraph-help mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/igraph-help
[Prev in Thread] | Current Thread | [Next in Thread] |