You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
11 lines
450 B
11 lines
450 B
def create_word_cloud(keyword_counts):
|
|
"""
|
|
生成词云图。
|
|
:param keyword_counts: 关键词及其出现次数的字典
|
|
"""
|
|
wc = WordCloud(font_path='simhei.ttf', background_color='white', width=800, height=600)
|
|
wc.generate_from_frequencies(keyword_counts)
|
|
plt.imshow(wc, interpolation='bilinear')
|
|
plt.axis("off")
|
|
plt.title("Top Danmakus Related to AI Technology in 2024 Paris Olympics")
|
|
plt.show() |