plot a graph of co-occurrence of terms, as returned by `get_cooc_entities()`. The function uses ggraph, so some color options can not work as expected due to some package incompatibilities. The plot_pos_graph is based in ggraph, that is based on ggplot2. That means that is possible to customize the graph with ggplot2 functions, like `labs()`.
Usage
plot_pos_graph(
pos_list,
n_head = 30,
edge_color = "lightblue",
edge_alpha = 0.1,
font_size = 2,
font_color = "black",
point_fill = "firebrick4",
point_alpha = 0.3,
point_color = "firebrick4",
graph_layout = "graphopt"
)
Arguments
- pos_list
a list of POS, as returned by `get_cooc_entities()`
- n_head
maximum number of edges to show. The freq column must be ordered
- edge_color
color of the edges
- edge_alpha
transparency of the edges. Values between 0 and 1.
- font_size
integer. font size of the nodes. Values between 1 and 2.
- font_color
color of the nodes.
- point_fill
color of the nodes
- point_alpha
transparency of the nodes
- point_color
color of the nodes
- graph_layout
layout of the graph
Examples
gr <- ex_txt_wiki[2:44] |>
filter_by_query("Police") |>
parsePOS()
#> Error: object 'ex_txt_wiki' not found
gr <- gr |> get_cooc_entities()
#> Error: object 'gr' not found
plot_pos_graph(gr)
#> Error in eval(expr, envir) : object 'gr' not found
#> Warning: restarting interrupted promise evaluation
#> Error in eval(expr, envir) : object 'gr' not found
#> Warning: restarting interrupted promise evaluation
#> Error in eval(expr, envir) : object 'gr' not found
#> Error in plot_pos_graph(gr): object 'head_edges' not found
gr <- ex_txt_wiki[2:44] |>
filter_by_query("Brian") |>
parsePOS()
#> Error: object 'ex_txt_wiki' not found
gr <- gr |> get_cooc_entities()
#> Error: object 'gr' not found
plot_pos_graph(gr)
#> Error in eval(expr, envir) : object 'gr' not found
#> Warning: restarting interrupted promise evaluation
#> Error in eval(expr, envir) : object 'gr' not found
#> Warning: restarting interrupted promise evaluation
#> Error in eval(expr, envir) : object 'gr' not found
#> Error in plot_pos_graph(gr): object 'head_edges' not found