addNodeSize: Modify the node size of a 'sigmaNet' object.

Description Usage Arguments Details Value Examples

Description

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.

Usage

1
2
addNodeSize(sigmaObj, minSize = 1, maxSize = 3, sizeMetric = "degree",
  sizeVector = NULL, oneSize = NULL)

Arguments

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

Details

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.

Value

A 'sigmaNet' object with modified node sizes 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
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

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