I'm trying to replicate some quanteda()
applications from this post. Yet when I replicated their textplot_wordcloud()
example on Presidential speeches, the group labels on my output does not contain highlight colors like grey-ish background in the example:
Since the textplot_wordcloud()
function is inherited from comparison.cloud()
, so I refer back to the latter's document to see if it has any arguments to set label highlight colors, but couldn't find any. I am wondering if it's possible to highlight group labels in textplot_wordcloud()
with colors?
The replication code is attached at below.
library(quanteda)
data(data_corpus_inaugural)
compDfm <- dfm(corpus_subset(data_corpus_inaugural, President %in% c("Washington", "Jefferson", "Madison")),
groups = "President", remove = stopwords("english"), removePunct = TRUE)
You are looking at an old example. You should look here on the quanteda website for current plotting examples.
The function textplot_wordcloud
has been rewritten and only uses internal quanteda calls so the reference to wordcloud::wordcloud_comparison
is not really valid anymore. In this case you can't set the back ground color for the labels anymore. You can adjust the color and the size of the labels if you want to:
library(quanteda)
# Package version: 2.0.0
# See https://quanteda.io for tutorials and examples.
corpus_subset(data_corpus_inaugural,
President %in% c("Washington", "Jefferson", "Madison")) %>%
dfm(groups = "President", remove = stopwords("english"), remove_punct = TRUE) %>%
dfm_trim(min_termfreq = 5, verbose = FALSE) %>%
textplot_wordcloud(comparison = TRUE,
labelcolor = "green",
labelsize = 2)