Description Usage Arguments Details Value Examples
Modify the node colors in an existing 'sigmaNet' object by providing one of the following: (1) a single color to use for all nodes or; (2) a vertex attribute from your original 'igraph' object. If you are using a vertex attribute, you can also specify a color palette from the 'RColorBrewer' package.
1 2 | addNodeColors(sigmaObj, oneColor = NULL, colorAttr = NULL,
colorPal = "Dark2")
|
sigmaObj |
A 'sigmaNet' object - created using the 'sigmaFromIgraph' function |
oneColor |
A single color to color all of the nodes (hex format) |
colorAttr |
An attribute from the original 'igraph' nodes to color the nodes by |
colorPal |
The color palatte to use - only used if colorAttr is specified |
*It is most useful to use the pipe operator from the 'magrittr' package with this function.
A 'sigmaNet' object with modified node colors. 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 | library(igraph)
library(sigmaNet)
library(magrittr)
data(lesMis)
l <- layout_nicely(lesMis)
#one color for all nodes
sig <- sigmaFromIgraph(graph = lesMis, layout = l) %>%
addNodeColors(oneColor = '#D95F02')
sig
#color based on attribute (edge betweenness cluster)
clust <- cluster_edge_betweenness(lesMis)$membership
V(lesMis)$group <- clust
sig <- sigmaFromIgraph(graph = lesMis, layout = l) %>%
addNodeColors(colorAttr = 'group', colorPal = 'Set1')
sig
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.