2020# ' \code{Nodes} data frame.
2121# ' @param height numeric height for the network graph's frame area in pixels.
2222# ' @param width numeric width for the network graph's frame area in pixels.
23+ # ' @param colourScale character string specifying the categorical colour
24+ # ' scale for the nodes. See
25+ # ' \url{https://github.com/mbostock/d3/wiki/Ordinal-Scales}.
2326# ' @param fontsize numeric font size in pixels for the node text labels.
2427# ' @param linkDistance numeric or character string. Either numberic fixed
2528# ' distance between the links in pixels (actually arbitrary relative to the
7174# '
7275# ' @export
7376forceNetwork <- function (Links , Nodes , Source , Target , Value , NodeID ,
74- Group , height = NULL , width = NULL , fontsize = 7 , linkDistance = 50 ,
77+ Group , height = NULL , width = NULL , colourScale = " d3.scale.category20()" ,
78+ fontsize = 7 , linkDistance = 50 ,
7579 linkWidth = " function(d) { return Math.sqrt(d.value); }" , charge = - 120 ,
7680 linkColour = " #666" ,opacity = 0.6 , zoom = FALSE )
7781{
@@ -97,6 +101,7 @@ forceNetwork <- function(Links, Nodes, Source, Target, Value, NodeID,
97101 options = list (
98102 NodeID = NodeID ,
99103 Group = Group ,
104+ colourScale = colourScale ,
100105 fontsize = fontsize ,
101106 clickTextSize = fontsize * 2.5 ,
102107 linkDistance = linkDistance ,
0 commit comments