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.
get_net_cooccur_igraph(play = NULL, corpus = NULL, as_igraph = FALSE)# S3 method for 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 cooccur_igraph
summary(object, ...)
cooccur_igraph
— an object that inherits igraph
and can be
treated as such.
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.
Character, name of the corpus (you can find all corpus names in
name
column within an object returned by
get_dracor_meta
).
Logical, if TRUE
, returns simple igraph object
instead of cooccur_igraph
. FALSE
by default.
A cooccur_igraph
object to plot.
Function, an algorithm used for the graph layout. See igraph.plotting.
Character vector of character names. By default,
function label_cooccur_igraph
is used to avoid overplotting on
large graphs.
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.
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.
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.
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.
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.
See igraph.plotting.
See igraph.plotting.
See igraph.plotting.
See igraph.plotting.
Other arguments to be passed to plot.igraph
An object of class cooccur_igraph
.
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
get_net_relations_igraph
label_cooccur_igraph
# \donttest{
emilia_igraph <- get_net_cooccur_igraph(
play = "lessing-emilia-galotti",
corpus = "ger"
)
igraph::diameter(emilia_igraph)
plot(emilia_igraph)
summary(emilia_igraph)
# }
Run the code above in your browser using DataLab