set_network_attributes: Set some default network attributes for pretty plotting

View source: R/semnet_plotting.r

set_network_attributesR Documentation

Set some default network attributes for pretty plotting

Description

The purpose of this function is to create some default network attribute options to plot networks in a nice and insightfull way.

Usage

set_network_attributes(
  g,
  size_attribute = "freq",
  color_attribute = NA,
  redo_layout = F,
  edgewidth_coef = 1,
  layout_fun = igraph::layout_with_fr
)

Arguments

g

A graph in the Igraph format.

size_attribute

the name of the vertex attribute to be used to set the size of nodes

color_attribute

the name of the attribute that is used to select the color

redo_layout

if TRUE, force new layout if layout already exists as a graph attribute

edgewidth_coef

A coefficient for changing the edge width

layout_fun

THe igraph layout function used

Value

a network in the Igraph format

Examples

tc = create_tcorpus(c('A B C', 'B C', 'B D'))
g = semnet(tc, 'token')

igraph::get.edge.attribute(g)
igraph::get.vertex.attribute(g)
plot(g)
g = set_network_attributes(g, size_attribute = 'freq')
igraph::get.edge.attribute(g)
igraph::get.vertex.attribute(g)
plot(g)

corpustools documentation built on May 31, 2023, 8:45 p.m.