权当个人自学使用,仅供参考
Reference:
某自己学校老师编的python程序设计基础
https://www.cnblogs.com/randysun/p/11215095.html
基本入门
import wordcloud
w = wordcloud.WordCloud()
#载入字符串
w.generate("Python and WordCloud")
#输出为png图片
w.to_file("pywordcloud.png")
参数列表
from wordcloud import WordCloud
#长宽、背景色
wc1 = WordCloud(width = 1500, height = 900, background_color = 'white')
wc1.generate("A little word cloud generator... wordcloud depends on numpy and pillow. To save the wordcloud into a file, matplotlib can also be installed. See examp")
wc1.to_file('wc.png')