I recently created an interactive visualization of my collaboration ego-network. Some colleagues have asked for more details, so here’s this post.
I gave networkD3 a try and I was impressed. Like I said, I used it to create an interactive visualization of my collaboration ego-network — the collaboration network (who works with whom) of the people and institutes that I (ego) have been working with lately. With basically one line of code, networkD3 allows you to create a fairly complicated html document based on D3 functions. The R code is here.
(Click here for a larger version of the graph)
Most of the R code just prepares the data in a format that’s suitable for networkD3. Something that might be tricky at first is the fact that in networkD3 nodes need to be numbered starting from 0 (not from 1 like standard R packages for network analysis). The main function here is
Once you get the visualization, you can export it to html or embed it in RMarkdown or Shiny. If you use WordPress, it’s good to know that you can very easily embed your networkD3 html file in a WordPress post or page. All you need is the iframe plugin to embed any external content in WordPress. You’ll then just have to upload your html page as created by networkD3 to your WordPress media library, and use that html as the iframe source.