I am working with the igraph package in R to visualise network flows.
library(igraph)
# Example Data:
b <- c("countryA", "countryB", "countryC", "countryA", "countryC", "countryA")
c <- c("countryB", "countryC", "countryA", "countryB", "countryA", "countryB")
d<- c(100, 200, 200, 300, 400, 200)
e <- c(5,12,10,24,25,12)
mydata <- data.frame(b,c,d,e)
colnames(mydata) <- c("exporteur", "partner", "tradeflow", "price")
# Plot in igraph
mydata.igraph <- graph.data.frame(mydata)
E(mydata.igraph)$label <- mydata[,3]
plot(mydata.igraph)
As you can see, my edge labels (labels of the arrows) are overlapping. How to solve this?
Thanks in advance!
vertex.label.dist
is possible but it seems not yet for edges – Slalomsna
package, maybe that supports it, although I haven't checked, so I am not sure. If you want to plot diagrams, you can also look at thediagram
package. To do it with igraph, you'll need to plot the labels as an additional step, with thetext()
function. – Weaks