Share on facebook
Share on twitter
Share on linkedin
Share on pinterest

WordClouds in Python

In this article, we are going to see how to create a word cloud in python.

A word cloud creates a collage of most prominent words from the given text. The size of each word is related to the frequency of the word in the text.

In python, to generate a word cloud, we can use the word cloud package.

If you don’t have it installed, you can install it using the following command

Let’ see how to create a word cloud

Now we can use matplotlib to display the word cloud

word cloud

We can also create a word cloud of any shape. All we have to do is to provide an image.

Let’s create a word cloud using the following image as the mask image.

mask image

Let’s load the image using Image function from the Pillow module.

To install the Pillow module, use the following command

word cloud


Love What you Read. Subscribe to our Newsletter.

Stay up to date! We’ll send the content straight to your inbox, once a week. We promise not to spam you.

Subscribe Now! We'll keep you updated.