Plot an fcm object as a network, where edges show co-occurrences of features.

textplot_network(x, min_freq = 0.5, omit_isolated = TRUE,
  edge_color = "skyblue", edge_alpha = 0.5, edge_size = 2,
  vertex_color = "gray40", vertex_size = 2, vertex_labelcolor = NULL,
  offset = NULL, ...)

# S3 method for fcm
as.network(x, min_freq = 0.5, omit_isolated = TRUE, ...)

Arguments

x

a fcm or dfm object

min_freq

a frequency count threshold or proportion for co-occurance frequencies of features to be plotted.

omit_isolated

if TRUE, features do not occur more frequent than min_freq will be omitted from the plot

edge_color

color of edges that connect vertices.

edge_alpha

opacity of edges ranging from 0 to 1.0.

edge_size

size of edges for most frequent cooccurances. The size of other edges are determined proportionally to the highest frequency.

vertex_color

color of vertices.

vertex_size

size of vertices.

vertex_labelcolor

color of texts. Defaults to the same as vertex_color. If NA is given, texts are not rendered.

offset

if NULL, the distance between vertices and texts are determined automatically.

...

additional arguments passed to network.

Details

Currently the size of the network is limited to 1000, because of the computationally intensive nature of network formation for larger matrices. When the fcm is large, users should select features using fcm_select, set the threshold using min_freq, or implement own plotting function using as.network.

See also

fcm

Examples

# NOT RUN {
toks <- corpus_subset(data_corpus_irishbudget2010) %>%
    tokens(remove_punct = TRUE) %>%
    tokens_tolower() %>%
    tokens_remove(stopwords("english"), padding = FALSE)
myfcm <- fcm(toks, context = "window", tri = FALSE)
feat <- names(topfeatures(myfcm, 30))
textplot_network(myfcm, min_freq = 10)
fcm_select(myfcm, feat, verbose = FALSE) %>% textplot_network(min_freq = 0.5)
fcm_select(myfcm, feat, verbose = FALSE) %>% textplot_network(min_freq = 0.8)
fcm_select(myfcm, feat, verbose = FALSE) %>%
        textplot_network(min_freq = 0.8, vertex_labelcolor = rep(c('gray40', NA), 15))
# }