#wordcloud 这个包下载有问题
# install.packages("wordcloud")
# library(wordcloud)
# wordcloud(sms_corpus_train, min.freq=30, random.order=FALSE,colors="blue")
install.packages("yaml")
library(yaml)
#需要先下载这个包
devtools::install_github('lchiffon/wordcloud2')
library(wordcloud2)
wordcloud2(demoFreqC, shape = "diamond")
wordcloud2(demoFreq, shape = "star", backgroundColor = "black")
letterCloud(demoFreqC, word = "LOVE", wordSize = 2)
#自带数据的例子
#javasript回调函数: 用js撰写任意的颜色生成函数,如
js_color_fun = "function (word, weight) {
return (weight > 1000) ? '#f02222' : '#c09292';
}"
wordcloud2(demoFreqC, color = htmlwidgets::JS(js_color_fun),
backgroundColor = 'black')
#定制形状
#设置形状为星型
wordcloud2(demoFreq, shape = "star", backgroundColor = "black")
#设置行政为LOVE的样子
letterCloud(demoFreqC, word = "LOVE", wordSize = 2)
wordcloud2(demoFreqC, figPath='D:\R\1s.png')