How to separate red mark from edge in igraph?

I would like to move the position of the cue mark so that it is not on top of it. Here is a small example:

g <- graph.empty(n=3) g <- graph(c(1,2,3,2,1,3), directed=T) E(g)$weight <- c(3,2,5) plot(g, edge.label = E(g)$weight) 

In my example, the labels are on the edges, and I want them to be a little perpendicular to the edge.

+10
r graph-theory label igraph edge
source share
2 answers

Use edge.label.cex and edge.label.dist in the plot function. I think it works!

+1
source share

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() 
0
source share

All Articles