Skip to content

Commit d3e7961

Browse files
committed
wordcloud代码注释
1 parent 28e1f64 commit d3e7961

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

PythonDemo/wordcloud/examples/simple.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,21 @@
1414
# 读取整个文本
1515
text = open(path.join(d, 'constitution.txt')).read()
1616

17-
# Generate a word cloud image
17+
# 生成一个词云图像
1818
wordcloud = WordCloud().generate(text)
1919

20-
# Display the generated image:
21-
# the matplotlib way:
20+
# matplotlib的方式展示生成的词云图像
2221
import matplotlib.pyplot as plt
2322
plt.imshow(wordcloud, interpolation='bilinear')
2423
plt.axis("off")
2524

26-
# lower max_font_size
27-
wordcloud = WordCloud(max_font_size=40).generate(text)
25+
#设定生成词云中的文字最大大小
26+
wordcloud = WordCloud(max_font_size=66).generate(text)
2827
plt.figure()
2928
plt.imshow(wordcloud, interpolation="bilinear")
3029
plt.axis("off")
3130
plt.show()
3231

33-
# The pil way (if you don't have matplotlib)
32+
# pil方式展示生成的词云图像(如果你没有matplotlib)
3433
# image = wordcloud.to_image()
3534
# image.show()

0 commit comments

Comments
 (0)