Description Usage Arguments Source Examples
simpleNetwork
creates simple D3 JavaScript force directed network
graphs.
1 2 3 | simpleNetwork(Data, Source = 1, Target = 2, height = NULL, width = NULL,
linkDistance = 50, charge = -30, fontSize = 7, fontFamily = "serif",
linkColour = "#666", nodeColour = "#3182bd", opacity = 0.6, zoom = F)
|
Data |
a data frame object with three columns. The first two are the names of the linked units. The third records an edge value. (Currently the third column doesn't affect the graph.) |
Source |
character string naming the network source variable in the data
frame. If |
Target |
character string naming the network target variable in the data
frame. If |
height |
height for the network graph's frame area in pixels (if
|
width |
numeric width for the network graph's frame area in pixels (if
|
linkDistance |
numeric distance between the links in pixels (actually arbitrary relative to the diagram's size). |
charge |
numeric value indicating either the strength of the node repulsion (negative value) or attraction (positive value). |
fontSize |
numeric font size in pixels for the node text labels. |
fontFamily |
font family for the node text labels. |
linkColour |
character string specifying the colour you want the link lines to be. Multiple formats supported (e.g. hexadecimal). |
nodeColour |
character string specifying the colour you want the node circles to be. Multiple formats supported (e.g. hexadecimal). |
opacity |
numeric value of the proportion opaque you would like the graph elements to be. |
zoom |
logical value to enable ( |
D3.js was created by Michael Bostock. See http://d3js.org/ and, more specifically for directed networks https://github.com/d3/d3/blob/master/API.md#forces-d3-force
1 2 3 4 5 6 7 8 | # Fake data
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
simpleNetwork(NetworkData)
simpleNetwork(NetworkData, fontFamily = "sans-serif")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.