Skip to content

Instantly share code, notes, and snippets.

@satishkt
Created February 20, 2016 10:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save satishkt/e395997c57d219e6d4bc to your computer and use it in GitHub Desktop.
Save satishkt/e395997c57d219e6d4bc to your computer and use it in GitHub Desktop.
from wordcloud import WordCloud
wordcloud = WordCloud().generate(text)
# Display the generated image:
# the matplotlib way:
import matplotlib.pyplot as plt
plt.imshow(wordcloud)
plt.axis("off")
# take relative word frequencies into account, lower max_font_size
wordcloud = WordCloud(max_font_size=40, relative_scaling=.5).generate(text)
plt.figure()
plt.imshow(wordcloud)
plt.axis("off")
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment