plot_charinet: Plot the character interaction network using ggraph

View source: R/plot_charinet.R

plot_charinetR Documentation

Plot the character interaction network using ggraph

Description

Create a quick visualisation of the aggregated character interaction network.

Usage

plot_charinet(
  adjacency = NULL,
  char_names = NULL,
  degree = NULL,
  cutoff = NULL,
  drop_isolates = TRUE,
  node_fill = "#eb4034",
  parallel_edges = FALSE,
  title = ""
)

Arguments

adjacency

The adjacency matrix based on a given character interaction network event list.

char_names

A vector of character names, arranged in order of the character IDs. If not supplied, names will be inferred from the rownames of adjacency.

degree

A vector of numeric values containing information on the degree/activity of nodes. This will be used to scale the size of the nodes in the network diagram.

cutoff

A numeric value to be used to filter the visualisation to only include those characters whose degree is greater than cutoff.

drop_isolates

Logical. If TRUE, nodes with no ties to other nodes will not be included in the graph.

node_fill

A character string providing the colour to be used to fill the nodes.

parallel_edges

Logical. If TRUE, directed edges will be drawn as two separate parallel arrows. If FALSE, a single double-sided arrow will be drawn.

title

An optional character string which can be used to add a title to the visualisation.

Value

A ggplot2 plot.

Examples

tfa <- movienetdata::starwars_tfa
## Not run: 
# Plot the network, dropping characters who don't speak more than 3 lines
plot_charinet(adjacency = tfa$adjacency,
              char_names = tfa$nodelist$char_name,
              degree = tfa$nodelist$nlines,
              cutoff = 3,
              title = "Dialogue interactions in Star Wars: The Force Awakens")
## End(Not run)


pj398/charinet documentation built on May 2, 2024, 10:28 p.m.