2017-02-03 34 views
1

假设,我有一个数据框,其中包含一些词与他们的频率。我想创建R中有标志的形状,里面的字wordcloud,例如Twitter的标志,就像这样: enter image description here具有特定形状的Wordcloud

+0

好难过。在google中输入只能提供python解决方案。 –

回答

7

可以使用wordcloud2软件包内。它允许您使用任何图像作为蒙版。只需放入工作目录并使用figpath链接到它。以下是我用来制作wordcloud的代码。下面是wordcloud。 Here是我用作蒙版的图像。

library(wordcloud2) 
wordcloud2(demoFreq, figPath = "twitter.jpg") 

enter image description here