In the igraph package for R, I am struggling to plot a social network using latitude/longitude coordinates as the layout of the graph.
Imagine this simple example: a network with 4 nodes of which you know the geographical location and the connections:
df<-data.frame("from" = c("Bob", "Klaus", "Edith", "Liu"), "to"= c("Edith", "Edith", "Bob", "Klaus"))
Here you have the meta-data for the nodes, so that Bob lives in NY, Klaus in Berlin, Edith in Paris and Liu in Bejing:
meta <- data.frame("name"=c("Bob", "Klaus", "Edith", "Liu"), "lon"=c(-74.00714, 13.37699, 2.34120, 116.40708), "lat"=c(40.71455, 52.51607, 48.85693, 39.90469))
We make g the igraph object...
g <- graph.data.frame(df, directed=T, vertices=meta)
...and we define our layout as the longitude/latitude coordinates
lo <- layout.norm(as.matrix(meta[,2:3]))
plot.igraph(g, layout=lo)
If you run this example with these (real) geo-coordinates, you'll see that it is "relatively" accurate in the sense that the locations are right relative to each other. However, if I plot a lot of coordinates like this, the worlds cartesian map looks "stretched out".
Is there a way I can really plot my nodes on a world map so that the coordinates are 100% right and I get to see the connections between my nodes? I really want to keep using the igraph package as it offers a lot of functionalities I might need later on when I want to analyze the links between nodes.