R语言制作词云

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/jiyang_1/article/details/72179417

一 安装wordcloud2包

       install.packages("wordcloud2"),若下载失败,则打开翻墙软件,重新下载。

二 wordcloud2函数说明

      在Rstudio的右边help中输入wordcloud2,搜索相关方法。


三 示例

1、星星图

library(wordcloud2)
wordcloud2(demoFreq, size = 1,shape = 'star')


2、中文

wordcloud2(demoFreqC, size = 2, fontFamily = "微软雅黑",color = "random-light", backgroundColor = "grey")

3、倾斜

wordcloud2(demoFreq, size = 2, minRotation = -pi/6, maxRotation = -pi/6,  rotateRatio = 1)  


4、自定义的文字云

letterCloud(demoFreqC,word = "姬", wordSize = 2, fontFamily = "微软雅黑",color = "random-light", backgroundColor = "grey")

5、自定义图片

batman = system.file("examples/picture.png",package = "wordcloud2")  
wordcloud2(demoFreq, figPath = batman, size = 1,color = "black")  





猜你喜欢

转载自blog.csdn.net/jiyang_1/article/details/72179417
今日推荐