Plot a network of co-ocurrence of terms. Because word frequencies can vary significantly, differences in text size can be substantial. Therefore, instead of adjusting text size, we vary the dot/node size, ensuring the text remains consistently sized and maintains readability. It is also possible to normalize the result with log.
Usage
plot_graph2(
text,
df,
head_n = 30,
edge_color = "lightblue",
edge_alpha = 0.5,
node_alpha = 0.5,
text_color = "black",
text_size = 1,
scale_graph = "scale_values"
)
Arguments
- text
an input text
- df
a dataframe of co-occurrence, extracted with `extract_graph()` and `count(n1, n2)`
- head_n
number of nodes to show - the more frequent
- edge_color
color of the edges
- edge_alpha
transparency of the edges. Values between 0 and 1.
- node_alpha
transparency of the nodes
- text_color
color of the text in nodes
- text_size
font size of the nodes
- scale_graph
name of a function to normalize the result. Sometime, the range of numbers are so wide that the graph becomes unreadable. Applying a function to normalize the result can improve the readability, for example using `scale_graph = "log2"`, or `"log10"`