WordCloud

1.9.6 · active · verified Fri Apr 10

WordCloud is a Python library for generating visual representations of text data, commonly known as word clouds or tag clouds. It takes text as input and visualizes the most frequent words, with the size of each word indicating its frequency. The library is actively maintained, with frequent updates, and focuses on efficient algorithms, flexible masking, and filling available space. The current version is 1.9.6.

Warnings

Install

Imports

Quickstart

This quickstart generates a basic word cloud from a sample string and displays it using Matplotlib. It demonstrates the core `WordCloud` class instantiation, text generation, and image display.

from wordcloud import WordCloud
import matplotlib.pyplot as plt

# Sample text data
text = "Python programming is fun. Python is great for data science. Data visualization with Python is powerful."

# Create a WordCloud object
wordcloud = WordCloud(width=800, height=400, background_color='white').generate(text)

# Display the generated image:
plt.figure(figsize=(10, 5))
plt.imshow(wordcloud, interpolation='bilinear')
plt.axis('off') # Turn off axes for a cleaner look
plt.title('My First Word Cloud')
plt.show()

view raw JSON →