Guilherme Parreira
Guilherme Parreira

Reputation: 1011

How to control the size of the vertex label in textplot_network?

I am able to control the vertex size, but not the vertex label size in textplot_network. Is there a way of doing it?

I saw the argument vertex.cex in plot.network but it doesn't work.

This is what I have got so far:

library(quanteda)
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))
myfcm <- fcm_select(myfcm, feat, verbose = FALSE)

textplot_network(myfcm, vertex_size = rowSums(myfcm)/min(rowSums(myfcm)),
                 vertex.cex = rowSums(myfcm)/min(rowSums(myfcm)))

enter image description here

Upvotes: 1

Views: 1034

Answers (2)

amatsuo_net
amatsuo_net

Reputation: 2448

As you can see from the source code, the font size is not an argument you can control in the function.

https://github.com/quanteda/quanteda/blob/master/R/textplot_network.R#L242-L256

If you really need the feature, please file a feature request here:

https://github.com/quanteda/quanteda/issues/new/choose

Upvotes: 1

user10624646
user10624646

Reputation:

If you switch to the visNetwork package instead in R - you can use the additional argument of Node Label Size - it also has a JS based back end so is useful for the other elements of text labelling

Upvotes: 1

Related Questions