Commit b35ed472 authored by Andreas Mueller's avatar Andreas Mueller
Browse files

add the "pil way" of showing an image to the

parent ea578eb1
......@@ -6,15 +6,19 @@ Generating a square wordcloud from the US constitution using default arguments.
from os import path
import matplotlib.pyplot as plt
from wordcloud import WordCloud
d = path.dirname(__file__)
# Read the whole text.
text = open(path.join(d, 'constitution.txt')).read()
# Generate a word cloud image
wordcloud = WordCloud().generate(text)
# Open a plot of the generated image.
# Display the generated image:
# the matplotlib way:
import matplotlib.pyplot as plt
......@@ -24,3 +28,7 @@ plt.figure()
# The pil way (if you don't have matplotlib)
#image = wordcloud.to_image()
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