footnote in word cloud

Viewed 52

Hell, I would like to make a word cloud with title and a footnote with date.

Here is my sample and codes:

y<-c("the", "the", "the", "tree", "tree", "tree", "tree", "tree", 
     "tree", "tree", "tree", "tree", "tree", "Wants", "Wants", "Wants", 
     "Wants", "Wants", "Wants", "Wants", "Wants", "Wants", "Wants", 
     "Wants", "Wants", "to~be", "to~be", "to~be", "to~be", "to~be", 
     "to~be", "to~be", "to~be", "to~be", "to~be", "to~be", "to~be", 
     "to~be", "to~be", "to~be", "to~be", "to~be", "to~be", "to~be", 
     "to~be", "when", "when", "when", "when", "when", "familiar", "familiar", 
     "familiar", "familiar", "familiar", "familiar", "familiar", "familiar", 
     "familiar", "familiar", "familiar", "familiar", "familiar", "familiar", 
     "familiar", "familiar", "familiar", "familiar", "familiar", "familiar", 
     "leggings", "leggings", "leggings", "leggings", "leggings", "leggings", 
     "leggings", "leggings", "leggings", "leggings")

layout(matrix(c(1,2,3), nrow=3, ncol=1), heights=c(1,4,1))
par(mar=rep(0,4,))
plot.new()
text(x=0.5,y=0.5, "Title")
set.seed(1234) # for reproducibility 
wordcloud(names(table(y)), table(y))
text(x=0.5,y=0.5, "Date 20200629")

and I got sth looks like this:

enter image description here

It looks like the the title is OK, but the footnote was mixed in with the word cloud. What did I do wrong? How should I fix it?

Thanks.

1 Answers
library(wordcloud)

y<-c("the", "the", "the", "tree", "tree", "tree", "tree", "tree", 
     "tree", "tree", "tree", "tree", "tree", "Wants", "Wants", "Wants", 
     "Wants", "Wants", "Wants", "Wants", "Wants", "Wants", "Wants", 
     "Wants", "Wants", "to~be", "to~be", "to~be", "to~be", "to~be", 
     "to~be", "to~be", "to~be", "to~be", "to~be", "to~be", "to~be", 
     "to~be", "to~be", "to~be", "to~be", "to~be", "to~be", "to~be", 
     "to~be", "when", "when", "when", "when", "when", "familiar", "familiar", 
     "familiar", "familiar", "familiar", "familiar", "familiar", "familiar", 
     "familiar", "familiar", "familiar", "familiar", "familiar", "familiar", 
     "familiar", "familiar", "familiar", "familiar", "familiar", "familiar", 
     "leggings", "leggings", "leggings", "leggings", "leggings", "leggings", 
     "leggings", "leggings", "leggings", "leggings")

layout(matrix(c(1,2,3), nrow=1, ncol=1), heights=c(1,4,1))
par(mar=rep(0,4,))
plot.new()
set.seed(1234) # for reproducibility 
wordcloud(names(table(y)), table(y))
text(x=0.5,y=1, "Title") # y=0 bottom; y=0.5 middle; y=1 upper; x=0 left; x=0.5 middle; x=1 right;
text(x=0.5,y=0, "Date 20200629") # y=0 bottom; y=0.5 middle; y=1 upper; x=0 left; x=0.5 middle; x=1 right;
Related