Skip to content

Instantly share code, notes, and snippets.

@seangtkelley
Created June 26, 2018 20:06
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 seangtkelley/e202816d6b4d04a3e60c3f56c5c3ffc1 to your computer and use it in GitHub Desktop.
Save seangtkelley/e202816d6b4d04a3e60c3f56c5c3ffc1 to your computer and use it in GitHub Desktop.
female_mask = np.array(Image.open(os.path.join(os.getcwd(), "female_mask.jpg")))
male_mask = np.array(Image.open(os.path.join(os.getcwd(), "male_mask.jpg")))
female_wordcloud = WordCloud(background_color="white", max_words=1000, mask=female_mask, margin=10,random_state=1).generate(female_text)
male_wordcloud = WordCloud(background_color="white", max_words=1000, mask=male_mask, margin=10,random_state=1).generate(male_text)
f, (ax1, ax2) = plt.subplots(1, 2, sharex=True)
f.set_size_inches(18, 20.0)
ax1.imshow(male_wordcloud, interpolation="bilinear")
ax1.set_title('Male Wordcloud', fontsize=36)
ax1.axis("off")
ax2.imshow(female_wordcloud, interpolation="bilinear")
ax2.set_title('Female Wordcloud', fontsize=36)
ax2.axis("off")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment