Skip to content

Instantly share code, notes, and snippets.

@cydal
Created March 18, 2021 11:59
Show Gist options
  • Save cydal/cb6b9ae6516a1496a41039a7cdccb186 to your computer and use it in GitHub Desktop.
Save cydal/cb6b9ae6516a1496a41039a7cdccb186 to your computer and use it in GitHub Desktop.
from wordcloud import WordCloud
plt.figure(figsize=(40,40))
j = np.ceil(len(set(labels_words))/10)
for topic_nbr, words in enumerate(set(labels_words)):
plt.subplot(j, 10, topic_nbr+1).set_title(str(topic_nbr))
wordcloud = WordCloud(background_color="white", contour_color='steelblue')
wordcloud.generate(words)
plt.imshow(wordcloud.to_image())
plt.axis("off")
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment