add_node_size {sgraph} | R Documentation |
Modify the node size of a sgraph object.
Description
Modify the node size of an existing sgraph object by providing either: (1) A single size to use for all nodes; (2) a vector of node sizes; or (3) a metric to use to scale the nodes.
Usage
add_node_size(
sigma_obj,
min_size = 1,
max_size = 3,
one_size = NULL,
size_vector = NULL
)
Arguments
sigma_obj |
sgraph object, returned by sigma_from_igraph function |
min_size |
Minimum node size on the graph (for scaling) |
max_size |
Maximum node size on the graph (for scaling) |
one_size |
A single size to use for all nodes |
size_vector |
An optional vector with the sizes for each node |
Value
A sgraph object with modified node sizes
Examples
library(igraph)
library(sgraph)
data(lesMis)
layout <- layout_nicely(lesMis)
# one size for all nodes
sig <- sigma_from_igraph(igraph = lesMis, layout = layout) %>%
add_node_size(one_size = 3)
sig
# using a vector
custom_size <- log10(degree(lesMis))
sig <- sigma_from_igraph(igraph = lesMis, layout = layout) %>%
add_node_size(size_vector = custom_size)
sig
[Package sgraph version 1.0.0 Index]