ComeçarComece de graça

More ggnetwork Plotting Options

Just like in the last lesson, ggnetwork also offers methods to quickly generate nice plots. It's important to keep in mind that each package has a different style, which may or may not appeal to you. Recall that ggnetwork works by converting a graph to a dataframe to be plotted by ggplot2. Therefore. all the parameterizations you're used to will be available. This gives you a great degree of flexibility, but could also mean more effort to achieve the aesthetic you desire. We'll repeat the exercise in the previous lesson, but this time using ggnetwork. This will give you a good point of comparison to decide which package you like the best.

The centrality and community membership attributes you created in the last exercise are still present.

Este exercício faz parte do curso

Case Studies: Network Analysis in R

Ver curso

Exercício interativo prático

Experimente este exercício completando este código de exemplo.

ggplot(
  # Draw a ggnetwork of retweet_graph_smaller
  ggnetwork(___, arrow.gap = 0.01), 
  aes(x = x, y = y, xend = xend, yend = yend)
) + 
  geom_edges(
    arrow = arrow(length = unit(6, "pt"), type = "closed"), 
    curvature = 0.2, color = "black"
  ) + 
  # Add a node layer, mapping color to comm and setting the size to 4
  ___(aes(color = ___), size = ___) + 
  theme_blank()
Editar e executar o código