Session Ready
Exercise

Interactive javascript plots

Another widely used framework for creating interactive plots is D3.js. It has a specific standard for creating network plots that we can automatically generate in R. On the one hand, this is highly convenient because, with just a few lines of code, you'll be able to create fully interactive D3.js plots. The drawback is that real customization only comes when you directly edit the output javascript source code from R (which is beyond the scope of this course). Nonetheless, it is quick and easy to create a nice D3.js network plot in R using the d3network library. In this lesson we'll load up the #rstats Twitter dataset and add community membership. Then we'll create a subgraph of just a few communities and render a D3.js network graph.

The tweet graph object, retweet_samp, is available.

Instructions 1/2
undefined XP
  • 1
  • 2
  • Run the ggnetwork code to see the static version of the retweet network.
  • Convert the tweet igraph object, retweet_samp, to a networkD3 object using igraph_to_networkD3().
    • Set community membership from retweet_samp object as the node grouping factor in the networkD3 object.