addNodeColors: Modify the node colors of a 'sigmaNet' object.

Description Usage Arguments Details Value Examples

Description

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.

Usage

1
2
addNodeColors(sigmaObj, oneColor = NULL, colorAttr = NULL,
  colorPal = "Dark2")

Arguments

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

Details

*It is most useful to use the pipe operator from the 'magrittr' package with this function.

Value

A 'sigmaNet' object with modified node colors. This object can be called directly to create a visualization, or modified by additional functions.

Examples

 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

iankloo/sigmaNet documentation built on May 13, 2019, 1:37 a.m.