Skip to contents

Plot CoCA

Usage

# S3 method for class 'CoCA'
plot(
  x,
  module = NULL,
  min = 0.15,
  max = 1,
  label.cex = 1.2,
  seed = 123,
  main = NULL,
  ...
)

Arguments

x

CoCA object returned by CoCA()

module

index for which module to plot (default = NULL)

min

edges with absolute weights under this value are not shown (default = 0.15)

max

highest weight to scale the edge widths too (default = 1)

label.cex

label size scaling factor (default = 1.2)

seed

random seed for layout reproducibility (default = 123)

main

title for plot (default = NULL)

...

Arguments to be passed to methods

Value

invisibly returns the igraph object

Examples

# \donttest{
data(ft_wv_sample)
data(jfk_speech)
jfk_speech$sentence <- tolower(jfk_speech$sentence)
jfk_speech$sentence <- gsub("[[:punct:]]+", " ", jfk_speech$sentence)
dtm <- dtm_builder(jfk_speech, sentence, sentence_id)

gen <- data.frame(pole1 = c("man", "new", "choose"), pole2 = c("nation", "world", "peace"))
space <- data.frame(pole1 = c("space", "moon", "science"), pole2 = c("nation", "world", "freedom"))
power <- data.frame(pole1 = c("great", "power", "new"), pole2 = c("peace", "freedom", "world"))

gen_dir <- get_direction(anchors = gen, wv = ft_wv_sample)
space_dir <- get_direction(anchors = space, wv = ft_wv_sample)
power_dir <- get_direction(anchors = power, wv = ft_wv_sample)
directions <- rbind(gen_dir, space_dir, power_dir)

classes <- CoCA(dtm, wv = ft_wv_sample, directions = directions)
#> Warning: Significance filtering left 1 rows with no non-zero ties. The CCA result will contain at
#>          least one small degenerate class.
# }