Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

set_network_attributes

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

Managing, Querying and Analyzing Tokenized Text

v0.4.10
GPL-3
Authors
Kasper Welbers and Wouter van Atteveldt
Initial release
2022-05-03

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.