Learn R Programming

sigmaNet (version 1.1.0)

addEdgeColors: Modify the edge colors of a 'sigmaNet' object.

Description

Modify the edge colors of a 'sigmaNet' object by providing either: (1) a single color to use for every edge; or (2) an attribute of the initial 'igraph' object that will be used to determine color.

Usage

addEdgeColors(sigmaObj, oneColor = NULL, colorAttr = NULL,
  colorPal = "Set2")

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

Value

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

Details

If the 2nd option is used, you can also specify a color palette from 'RColorBrewer.'

Examples

Run this code
# NOT RUN {
library(igraph)
library(sigmaNet)
library(magrittr)

data(lesMis)

l <- layout_nicely(lesMis)

#one color for all edges
sig <- sigmaFromIgraph(graph = lesMis, layout = l) %>%
  addEdgeColors(oneColor = '#D95F02')
sig

# }

Run the code above in your browser using DataLab