simpleNetwork

0th

Percentile

Function for creating simple D3 JavaScript force directed network graphs.

simpleNetwork creates simple D3 JavaScript force directed network graphs.

Usage
simpleNetwork(Data, Source = NULL, Target = NULL, height = NULL, width = NULL, linkDistance = 50, charge = -200, fontSize = 7, fontFamily = "serif", linkColour = "#666", nodeColour = "#3182bd", nodeClickColour = "#E34A33", textColour = "#3182bd", opacity = 0.6, zoom = F)
Arguments
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 Source = NULL then the first column of the data frame is treated as the source.
Target
character string naming the network target variable in the data frame. If Target = NULL then the second column of the data frame is treated as the target.
height
height for the network graph's frame area in pixels (if NULL then height is automatically determined based on context)
width
numeric width for the network graph's frame area in pixels (if NULL then width is automatically determined based on context)
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).
nodeClickColour
character string specifying the colour you want the node circles to be when they are clicked. Also changes the colour of the text. Multiple formats supported (e.g. hexadecimal).
textColour
character string specifying the colour you want the text to be before they are clicked. 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 (TRUE) or disable (FALSE) zooming
Source

D3.js was created by Michael Bostock. See http://d3js.org/ and, more specifically for directed networks https://github.com/mbostock/d3/wiki/Force-Layout

Aliases
  • simpleNetwork
Examples
# 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")

Documentation reproduced from package networkD3, version 0.2.13, License: GPL (>= 3)

Community examples

Looks like there are no examples yet.