Skip to content

Instantly share code, notes, and snippets.

@YiLi225
Last active May 5, 2022 22:00
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 YiLi225/e17d179639ba6a08e006ed17f7aaec6a to your computer and use it in GitHub Desktop.
Save YiLi225/e17d179639ba6a08e006ed17f7aaec6a to your computer and use it in GitHub Desktop.
##### Generate the wordcloud #####
my_freq_grams = freq_grams
curMask = np.array(Image.open(pathToYourPic))
wc = WordCloud(background_color='white',
stopwords=stopwords,
width=800,
height=600,
relative_scaling=.6,
max_font_size=60,
random_state=1234,
mask=curMask,
colormap=plt.cm.plasma
).generate_from_frequencies(my_freq_grams)
## create color
plt.figure(figsize=[15,15])
plt.imshow(wc, interpolation='bilinear')
plt.title('WordCloud - Game/Animation', fontsize = 'xx-large')
plt.axis('off')
plt.tight_layout(pad=0)
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment