Python做词云图

#词云的制作  在这里需要安装jieab和WordCloud两个库      
import jieba
from wordcloud import WordCloud
import matplotlib.pyplot as plt
word_list = [" ".join(jieba.cut(sentence)) for sentence in list_w]
new_text = ' '.join(word_list)
wordcloud = WordCloud(font_path='simhei.ttf', background_color="black").generate(new_text)
plt.imshow(wordcloud)
plt.axis("off")
plt.show()

你可能感兴趣的:(python)