from wordcloud import WordCloud f = open(u'testfile.txt', 'r').read() wordcloud = WordCloud(background_color="white", width=1000, height=860, margin=2).generate(f) import matplotlib.pyplot as plt plt.imshow(wordcloud) plt.axis("off") plt.show() wordcloud.to_file('test1.png') # 保存图片
一个简单的wordcloud
猜你喜欢
转载自blog.csdn.net/chuguofei/article/details/79041607
今日推荐
周排行