get_net_cooccur_igraph: Retrieve an igraph co-occurrence network for a play

View source: R/net.R

get_net_cooccur_igraphR Documentation

Retrieve an igraph co-occurrence network for a play

Description

get_net_cooccur_igraph() returns a play network, given play and corpus names. Play network is constructed based on characters' co-occurrence matrix. Each node (vertex) is a character (circle) or a group of characters (square), edges width is proportional to the number of common play segments where two characters occur together.

Usage

get_net_cooccur_igraph(play = NULL, corpus = NULL, as_igraph = FALSE)

## S3 method for class 'cooccur_igraph'
plot(
  x,
  layout = igraph::layout_with_kk,
  vertex.label = label_cooccur_igraph(x),
  gender_colors = c(MALE = "#0073C2", FEMALE = "#EFC000", UNKNOWN = "#99979D"),
  vertex_size_metric = c("numOfWords", "numOfScenes", "numOfSpeechActs", "degree",
    "weightedDegree", "closeness", "betweenness", "eigenvector"),
  vertex_size_scale = c(5, 20),
  edge_size_scale = c(0.5, 4),
  vertex_label_adjust = TRUE,
  vertex.label.color = "#03070f",
  vertex.label.family = "sans",
  vertex.label.font = 2L,
  vertex.frame.color = "white",
  ...
)

## S3 method for class 'cooccur_igraph'
summary(object, ...)

Arguments

play

Character, name of a play (you can find all play names in "playName" column within an object returned by get_dracor). Character vector (longer than 1) is not supported.

corpus

Character, name of the corpus (you can find all corpus names in name column within an object returned by get_dracor_meta).

as_igraph

Logical, if TRUE, returns simple igraph object instead of cooccur_igraph. FALSE by default.

x

A cooccur_igraph object to plot.

layout

Function, an algorithm used for the graph layout. See igraph.plotting.

vertex.label

Character vector of character names. By default, function label_cooccur_igraph is used to avoid overplotting on large graphs.

gender_colors

Named vector with 3 values with colors for MALE, FEMALE and UNKNOWN respectively. Set NULL to use the default igraph colors. If you set parameter vertex.color (see igraph.plotting), gender_colors will be ignored.

vertex_size_metric

Character value, one of "numOfWords", "numOfScenes", "numOfSpeechActs", "degree", "weightedDegree", "closeness", "betweenness", "eigenvector" that will be used as a metric for vertex size. Alternatively, you can specify vertex size by yourself using parameter vertex.size(see igraph.plotting), in this case parameter vertex_size_metric is ignored.

vertex_size_scale

Numeric vector with two values. The first number is for mean size of node(vertex), the second one is for node size variance. If you specify vertex size by yourself using parameter vertex.size(see igraph.plotting), vertex_size_scale is ignored.

edge_size_scale

Numeric vector with two values. The first number defines average size of edges, the second number defines edges size variance. If you specify edges size by yourself using parameter edge.width(see igraph.plotting), edge_size_scale is ignored.

vertex_label_adjust

Logical. If TRUE, labels positions are moved to the top of the respectives nodes. If FALSE, labels are placed in the nodes centers. TRUE by default. If you set parameter vertex.label.dist(see igraph.plotting) by yourself, vertex_label_adjust is ignored.

vertex.label.color

See igraph.plotting.

vertex.label.family

See igraph.plotting.

vertex.label.font

See igraph.plotting.

vertex.frame.color

See igraph.plotting.

...

Other arguments to be passed to plot.igraph

object

An object of class cooccur_igraph.

Value

cooccur_igraph — an object that inherits igraph and can be treated as such.

Functions

  • plot(cooccur_igraph): Plot cooccur_igraph using plot.igraph with slightly modified defaults.

  • summary(cooccur_igraph): Meaningful summary for "cooccur_igraph" object: network properties, gender distribution

See Also

get_net_relations_igraph label_cooccur_igraph

Examples


emilia_igraph <- get_net_cooccur_igraph(
  play = "lessing-emilia-galotti",
  corpus = "ger"
)
igraph::diameter(emilia_igraph)
plot(emilia_igraph)
summary(emilia_igraph)


Pozdniakov/rdracor documentation built on April 9, 2024, 1:20 a.m.