R – d3 make graph plot in one line using d3network

library(d3Network)
Source <- c(“A”, “A”, “A”, “A”, “B”, “B”, “C”, “C”, “D”)
Target <- c(“B”, “C”, “D”, “J”, “E”, “F”, “G”, “H”, “I”)
NetworkData <- data.frame(Source, Target)
# Create graph
d <- d3SimpleNetwork(NetworkData, height = 300, width = 700, fontsize = 15)

Screen Shot 2014-09-08 at 5.08.48 PM

Will generate a html file that contains all the data. You can open up the file in your browser and you will see an interactive plot with a few nodes.
It is also a lot of fun to drag and yank the node here and there.

It is also really amazing that how much data this package can handle, here is a post from R-bloggers that show you a few graphs with more data points.

Screen Shot 2014-09-08 at 5.07.58 PM

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s