Sorry the guy who says "How about using library (x)?"
My code using ggraph?
library(igraph) library(ggraph) g <- graph.empty(n=3) g <- graph(c(1,2,3,2,1,3), directed=T) E(g)$weight <- c(3,2,5) #your plot plot(g, edge.label = E(g)$weight) #using ggraph ggraph(graph = g) + geom_node_circle(size = 1, mapping = aes(r =0.03), fill="goldenrod") + geom_edge_link(mapping = aes (label = weight), arrow = arrow(type = "closed", angle = 15), end_cap = circle(8, 'mm'), , start_cap = circle(8, 'mm'), colour="grey", label_dodge = unit(5, "mm"), angle_calc = "along") + geom_node_text(mapping = aes(label = "2")) + theme_graph()
No more hacks
source share