Commit e5631add authored by Andreas Mueller's avatar Andreas Mueller

don't use python2 by default in examples, fix stopwords in colored.py

parent 13ee3c86
#!/usr/bin/env python2 #!/usr/bin/env python
""" """
Using custom colors Using custom colors
==================== ====================
......
#!/usr/bin/env python2 #!/usr/bin/env python
""" """
Image-colored wordcloud Image-colored wordcloud
======================== ========================
...@@ -25,10 +25,11 @@ text = open(path.join(d, 'alice.txt')).read() ...@@ -25,10 +25,11 @@ text = open(path.join(d, 'alice.txt')).read()
# read the mask / color image # read the mask / color image
# taken from http://jirkavinse.deviantart.com/art/quot-Real-Life-quot-Alice-282261010 # taken from http://jirkavinse.deviantart.com/art/quot-Real-Life-quot-Alice-282261010
alice_coloring = np.array(Image.open(path.join(d, "alice_color.png"))) alice_coloring = np.array(Image.open(path.join(d, "alice_color.png")))
stopwords = set(STOPWORDS)
stopwords.add("said")
wc = WordCloud(background_color="white", max_words=2000, mask=alice_coloring, wc = WordCloud(background_color="white", max_words=2000, mask=alice_coloring,
stopwords=STOPWORDS.add("said"), stopwords=stopwords, max_font_size=40, random_state=42)
max_font_size=40, random_state=42)
# generate word cloud # generate word cloud
wc.generate(text) wc.generate(text)
......
#!/usr/bin/env python2 #!/usr/bin/env python
""" """
Masked wordcloud Masked wordcloud
================ ================
......
#!/usr/bin/env python2 #!/usr/bin/env python
""" """
Minimal Example Minimal Example
=============== ===============
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment