How to increase font size of TermDocumentMatrix plot on Rstudio?

275 views Asked by At

I'm working on some tweets and using text mining techniques.

I used the following command, and the plot is unreadable because the font size is so small. How can I fix it?

plot(tdm, term = freq.terms, corThreshold = 0.95, ps=30)

Plot

1

There are 1 answers

0
Curious George On

I don't necessarily have your data but here is a generic line of code to work with. The key is in the attributes "attrs" and setting the "fontsize" to whatever works for your tdm. Messing around with the corlimit and lowfreq will help reduce or increase the amount nodes and connecting lines, which also affect font sizing. I would just create the plot with the parameters you or your client want, then increasing the font in the attributes line.

corlimit <- 0.95
freq.term <- findFreqTerms(tdm,lowfreq=1000)    
plot(tdm,main=title,term=freq.term, corThreshold=corlimit,
attrs=list(node=list(width=20,fontsize=74,fontcolor="blue",color="red")))

The following is with the font and attributes line enter image description here

The same plot without the attribute line enter image description here