Description Usage Arguments Details Value Examples
Modify the node size of an existing 'sigmaNet' object by providing one of the following: (1) A single size to use for all nodes; (2) a vector of node sizes (this must be the same length as the number of nodes in the graph); or (3) a metric to use to scale the nodes.
1 2 | addNodeSize(sigmaObj, minSize = 1, maxSize = 3, sizeMetric = "degree",
sizeVector = NULL, oneSize = NULL)
|
sigmaObj |
A 'sigmaNet' object - created using the 'sigmaFromIgraph' function |
minSize |
The minimum node size on the graph (for scaling) |
maxSize |
The maximum node size on the graph (for scaling) |
sizeMetric |
The metric to use when sizing the nodes. Options are: degree, closeness, betweenness, pageRank, or eigenCentrality. |
sizeVector |
An optional vector with the sizes for each node (overrides sizeMetric and min/maxSize) |
oneSize |
A single size to use for all nodes |
If using the 2nd or 3rd approach, specifying the minSize and maxSize attributes will scale the nodes according to your specification, between these min- and max sizes.
A 'sigmaNet' object with modified node sizes This object can be called directly to create a visualization, or modified by additional functions.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | library(igraph)
library(sigmaNet)
library(magrittr)
data(lesMis)
l <- layout_nicely(lesMis)
#one size for all nodes
sig <- sigmaFromIgraph(graph = lesMis, layout = l) %>%
addNodeSize(oneSize = 3)
sig
#using a size attribute
sig <- sigmaFromIgraph(graph = lesMis, layout = l) %>%
addNodeSize(sizeMetric = 'degree', minSize = 2, maxSize = 8)
sig
#using a vector
customSize <- log10(degree(lesMis))
sig <- sigmaFromIgraph(graph = lesMis, layout = l) %>%
addNodeSize(sizeVector = customSize)
sig
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.