Wordcloud


A word cloud (also called tag cloud or weighted list) is a visual representation of text data. Words are usually single words, and the importance of each is shown with font size or color. Python fortunately has a wordcloud library allowing to build them.

⏱ Quick start

The wordcloud library is here to help you build a wordcloud in minutes. Here is a basic code snippets using the WordCloud() function to get you started.🔥

# Libraries
from wordcloud import WordCloud
import matplotlib.pyplot as plt

# Create a list of word
text=("Python Python Python Matplotlib")

# Create the wordcloud object
wordcloud = WordCloud(width=480, height=480, margin=0).generate(text)

# Display the generated image:
plt.imshow(wordcloud, interpolation='bilinear')
plt.axis("off")
plt.margins(x=0, y=0)
plt.show()

⚠️ The issue with wordclouds

Wordclouds are aesthetically pleasing and people are used to it, what make sure readers will understand them quick.

However, it is important to consider the caveats associated to them. For instance,longer words will take more space on the figure by construction which distorts reality. Moreover, it is impossible to translate a font size to an accurate value.

Barplot

Lollipop

Treemap

Circular Packing

Wordclouds with.. the wordcloud library 😀

The wordcloud library takes as input a string containing all the words you want to display. It passes it to the Wordcloud() function that will compute the display an show it on the screen thanks to the imshow() function.

Wordclouds and custom shapes

It is a common need to apply a specific shape to the wordcloud. TODO. Make a bette image. TODO: more proiminent link toward https://github.com/amueller/word_cloud

Use a mask to get a wordcloud with specific shape.

Contact

👋 This document is a work by Yan Holtz. Any feedback is highly encouraged. You can fill an issue on Github, drop me a message onTwitter, or send an email pasting yan.holtz.data with gmail.com.

Violin

Density

Histogram

Boxplot

Ridgeline

Scatterplot

Heatmap

Correlogram

Bubble

Connected Scatter

2D Density

Barplot

Spider / Radar

Wordcloud

Parallel

Lollipop

Circular Barplot

Treemap

Venn Diagram

Donut

Pie Chart

Dendrogram

Circular Packing

Line chart

Area chart

Stacked Area

Streamgraph

Timeseries with python

Timeseries

Map

Choropleth

Hexbin

Cartogram

Connection

Bubble

Chord Diagram

Network

Sankey

Arc Diagram

Edge Bundling

Colors

Interactivity

Animation with python

Animation

Cheat sheets

Caveats

3D