1

in the link is my previous question and codes about igraph in R

Creating Variables with Group in R igraph

My question now is why the arrow head in the example are small while mine are big like this:

enter image description here

How can I reshape the arrow to look like the answer on my previous question. I am using a mac.

Can you also help me create a legend based on the colour of the circle. Thank you.

Community
  • 1
  • 1
jbest
  • 640
  • 1
  • 10
  • 28

1 Answers1

3

Use appropriate values for edge.arrow.size. For me 1 works, but you may have to reduce it to 0.5 or less.

with(message, 
     plot(graph.data.frame(message), 
          vertex.color = sender_country,
          vertex.label.color = "white",
          edge.color = sender_country, 
          edge.arrow.width = 1, 
          edge.arrow.size = 1)
)

To add a legend just use legend and fill in the appropriate colors and labels. e.g.

legend('topright', legend = levels(message$sender_country), col = palette()[1:5], pch=16)
shadow
  • 21,823
  • 4
  • 63
  • 77