Create a D3 JavaScript Sankey diagram
sankeyNetwork(
Links,
Nodes,
Source,
Target,
Value,
NodeID,
NodeGroup = NULL,
NodeColor = NULL,
NodePosX = NULL,
NodePosY = NULL,
NodeValue = NULL,
NodeFontColor = NULL,
NodeFontSize = NULL,
LinkGroup = NULL,
linkColor = "#A0A0A0",
units = "",
colourScale = NULL,
fontSize = 12,
fontFamily = "Arial",
fontColor = NULL,
nodeWidth = 15,
nodePadding = NULL,
nodeStrokeWidth = 1,
nodeCornerRadius = 0,
margin = NULL,
title = NULL,
numberFormat = ",.1f",
orderByPath = FALSE,
highlightChildLinks = FALSE,
doubleclickTogglesChildren = FALSE,
xAxisDomain = NULL,
dragX = FALSE,
dragY = TRUE,
height = 500,
width = 800,
iterations = 32,
zoom = FALSE,
align = "left",
showNodeValues = TRUE,
linkType = "bezier",
curvature = 0.5,
nodeLabelMargin = 2,
linkOpacity = 0.5,
linkGradient = FALSE,
nodeShadow = FALSE,
scaleNodeBreadthsByString = FALSE,
xScalingFactor = 1,
yOrderComparator = NULL
)
a data frame object with the links between the nodes. It should
have include the Source
and Target
for each link. An optional
Value
variable can be included to specify the size (default is 1).
a data frame containing the node id and properties of the nodes.
If no ID is specified then the nodes must be in the same order as the
Source
variable column in the Links
data frame. Currently only
one grouping variable is allowed.
character string naming the network source variable in the
Links
data frame.
character string naming the network target variable in the
Links
data frame.
character string naming the variable in the Links
data
frame for how far away the nodes are from one another.
character string specifying the node IDs in the Nodes
.
data frame. Must be 0-indexed.
character string specifying the node groups in the
Nodes
. Used to color the nodes in the network.
character specifying a column in the Nodes
data
frame with the color of each node. Overrides colourScale.
character specifying a column in the Nodes
data
frame that specifies the 0-based ordering of the nodes along the x-axis.
character specifying a column in the Nodes
data
frame that specifies the 0-based ordering of the nodes along the y-axis.
character specifying a column in the Nodes
data
frame with the value/size of each node. If NULL
, the value is
calculated based on the maximum of the sum of incoming and outoging
links
character specifying a column in the Nodes
data
frame with the color of the label of each node.
character specifying a column in the Nodes
data
frame with the size of the label of each node.
character string specifying the groups in the
Links
. Used to color the links in the network.
numeric Color of links.
character string describing physical units (if any) for Value
character string specifying the categorical colour scale for the nodes. See https://github.com/mbostock/d3/wiki/Ordinal-Scales.
numeric font size in pixels for the node text labels. Default is 12.
font family for the node text labels. Default is 'Arial'.
font color for the node text labels.
numeric width of each node.
numeric essentially influences the width height. By default, it's the same as the fontSize parameter.
numeric width of the stroke around nodes.
numeric Radius for rounded nodes.
an integer or a named list
/vector
of integers
for the plot margins. If using a named list
/vector
,
the positions top
, right
, bottom
, left
are valid. If a single integer is provided, then the value will be
assigned to the right margin. Set the margin appropriately
to accomodate long text labels.
character Title of plot, put in the upper-left corner of the Sankey
number format in tooltips - see https://github.com/d3/d3-format for options. Default is ',.1f'.
boolean Order the nodes vertically along a path - this layout only works well for trees where each node has maximum one parent.
boolean Highlight all the links going right from a node or link.
boolean Show/hide target nodes and paths to the left on double-click. Does not hide incoming links of target nodes, yet.
character[] If xAxisDomain is given, an axis with those value is added to the bottom of the plot. Only sensible when also NodeXPos are given.
boolean Allow moving nodes along the x-axis? Default is FALSE.
boolean Allow moving nodes along the y-axis? Default is TRUE.
numeric height for the network graph's frame area in pixels. Default is 500.
numeric width for the network graph's frame area in pixels. Default is 800.
numeric. Number of iterations in the diagramm layout for computation of the depth (y-position) of each node. Note: this runs in the browser on the client so don't push it too high.
logical value to enable (TRUE
) or disable (FALSE
)
zooming
character Alignment of the nodes. One of 'right', 'left', 'justify', 'center', 'none'. If 'none', then the labels of the nodes are always to the right of the node. Default is 'left'.
boolean Show values above nodes. Might require and increased node margin.
character One of 'bezier', 'l-bezier', 'trapezoid', 'path1' and 'path2'.
numeric Curvature parameter for bezier links - between 0 and 1.
numeric margin between node and label.
numeric Opacity of links.
boolean Add a gradient to the links?
boolean Add a shadow to the nodes?
Put nodes at positions relatively to string lengths - only work well currently with align='none'
numeric Scale the computed x position of the nodes by this value.
Order nodes on the y axis by a custom function instead of ascending or descending depth.