如何控制textplot_network中顶点标签的大小?

时间:2019-01-16 16:16:18

标签: r graph quanteda

我能够控制顶点大小,但不能控制textplot_network中的顶点 label 大小。有办法吗?

我在vertex.cex中看到了自变量plot.network,但是它不起作用。

这是我到目前为止所得到的:

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

2 个答案:

答案 0 :(得分:2)

从源代码中可以看到,字体大小不是您可以在函数中控制的参数。

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

如果您确实需要此功能,请在此处提出功能请求:

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

答案 1 :(得分:1)

如果在R中切换到visNetwork包-可以使用Node Label Size的附加参数-它也具有基于JS的后端,因此对于文本标签的其他元素很有用