Doing a simple interactive network with the simpleNetwork() function of the networkD3 library
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
# Load package library(networkD3) library(webshot) # create data: set.seed(101) links=data.frame( source=c("A","A", "A", "A", "A","J", "B", "B", "C", "C", "D","I"), target=c("B","B", "C", "D", "J","A","E", "F", "G", "H", "I","I") ) # Plot graph=simpleNetwork(links) saveNetwork(graph,file = '#252_interactive_network_chart1.html',selfcontained = T) |
And we can custom it
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
simpleNetwork(links, Source = 1, # column number of source Target = 2, # column number of target height = 480, # height of frame area in pixels width = 480, linkDistance = 120, # distance between node. Increase this value to have more space between nodes charge = -480, # numeric value indicating either the strength of the node repulsion (negative value) or attraction (positive value) fontSize = 22, # size of the node names fontFamily = "serif", # font og node names linkColour = "#666", # colour of edges, MUST be a common colour for the whole graph nodeColour = "red", # colour of nodes, MUST be a common colour for the whole graph opacity = 0.8, # opacity of nodes. 0=transparent. 1=no transparency zoom = T # Can you zoom on the figure? ) |
Not what you are looking for ? Make a new search ![mediatagger]
Leave a Reply
Be the First to Comment!