Interactive Network Graphs in R with Plotly

On my quest to gain some experience with interactive network graphs  I stumbled on this fun little collection of gml format datasets and decided I wanted to make a network map in R with my current favorite graphing package, Plot.ly. I do want to say that there are some fantastic networks you can make with the equally exciting D3Network. Furthermore other D3 javascripts packages are out there for nearly every graph type but like my previous post dealing with Sentiment I decided I would be using Plot.ly again.

Also Plotly recently went the open-source route with this announcement:

Today, Plotly is announcing that we have open-sourced plotly.js, the core technology and JavaScript graphing library behind Plotly’s products – November 2015

Which makes it an invaluable tool in the developer tool-kit.

To get started they have a few walk-throughs for their API in R, Python and Matlab, but their’s and frankly a lot of other developer’s examples use the common Zachary’s Karate Club dataset. So I wanted to make use of one dataset I found intriguing on that list I linked to earlier. The one I chose was the Dolphin Social Network, which is the social network of a dolphin pod located off Doubtful Sound, in New Zealand. Interesting right?

Before I start I wanted to mention that Plot.ly expertly outlines the process in an example here.

Code

Here are the packages needed:

library(igraph)
library(plotly)
library(plyr)
library(curl)

The part that seems to deviate from a bit of the tutorial is my marker size, seen in the whole code chunk at the bottom, but highlighted here below.

I really enjoy the use of network maps especially in literature, which on the link I provided with the datasets there are a couple word association datasets that would be fun to mess with. I just wanted to put up a quick primer on these types of visualizations and I hope to be working with them more often in the future. So any input is welcome.