Get startedGet started for free

ggnet Basics

There are many ways to visualize a graph beyond the basic igraph plotting. A common framework is to use ggplot2, which provides a way to make high quality plots with minimal graphical parameter setting. In this lesson, we'll cover the basics of creating a plot with ggnet2. This package builds graph plots using the ggplot2 framework. While it produces nice graphics, it relies on graph objects from a different R library network, but it does make plots with a ggplot2 aesthetic without quite the formal grammar of graphics used by ggnetwork, as we'll see in the next lesson. Therefore, you'll notice a lot of overlap in the syntax with igraph (node.size is the same as vertex.size, and edge.size is the same name).

This exercise is part of the course

Case Studies: Network Analysis in R

View Course

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Create subgraph of retweet_graph
retweet_samp <- induced_subgraph(___, vids = ___)

# Plot retweet_samp using igraph
___(___, vertex.label = NA, edge.arrow.size = 0.2, edge.size = 0.5, vertex.color = "black", vertex.size = 1)
Edit and Run Code