Word Cloud
Visualizing keyword importance through frequency-based spatial distribution.
Visualizing keyword importance through frequency-based spatial distribution.
Font size maps to frequency: the most common word is largest, and all of it else is scaled relative to it. Position, colour and rotation almost always carry no data. They are chosen by a layout algorithm packing shapes into a space without overlap.
That is the first thing to know about reading one. Two words next to each other are not related; they simply fitted. Any interpretation based on adjacency or colour is reading structure that was never encoded.
A word cloud is, at its core, a frequency bar chart with the axes removed and the bars replaced by the words themselves. That makes it visually engaging and easy to scan, which is why it shows up in presentations and dashboards. But it also means it inherits every limitation of a frequency count. Words with similar counts are drawn at similar sizes, and the human eye is poor at comparing font sizes. So the ranking among mid-frequency words is unreliable. A bar chart would show those differences exactly; a word cloud hides them.
The preparation step matters more than the layout. Raw text fed into a word cloud generator will produce a cloud dominated by "the", "is", "and" and other stopwords that tell you nothing about the content. Removing stopwords, lowercasing, and optionally stemming or lemmatising the words is what turns the cloud from a picture of English grammar into a picture of the document's subject matter.
Word clouds work best as a first-pass exploration tool: glance at the biggest words, form a hypothesis about what the corpus contains. Then verify with actual counts or a more precise visualisation. Treating them as evidence rather than as a prompt for further investigation is the mistake that leads to misleading conclusions. A topic mentioned in every document with moderate frequency will be large. While a topic mentioned heavily in one document and nowhere else may not appear at all, depending on the aggregation.
Visualizing keyword importance through frequency-based spatial distribution.
A word cloud sizes each word by how often it appears. It is genuinely useful for a first look at a corpus, and it is a frequency chart with the axes removed - which is worth knowing before drawing conclusions from one.
Font size maps to frequency: the most common word is largest, and all of it else is scaled relative to it. Position, colour and rotation almost always carry no data. They are chosen by a layout algorithm packing shapes into a space without overlap.
That is the first thing to know about reading one. Two words next to each other are not related; they simply fitted. Any interpretation based on adjacency or colour is reading structure that was never encoded.
A word cloud is, at its core, a frequency bar chart with the axes removed and the bars replaced by the words themselves. That makes it visually engaging and easy to scan, which is why it shows up in presentations and dashboards. But it also means it inherits every limitation of a frequency count. Words with similar counts are drawn at similar sizes, and the human eye is poor at comparing font sizes. So the ranking among mid-frequency words is unreliable. A bar chart would show those differences exactly; a word cloud hides them.
The preparation step matters more than the layout. Raw text fed into a word cloud generator will produce a cloud dominated by "the", "is", "and" and other stopwords that tell you nothing about the content. Removing stopwords, lowercasing, and optionally stemming or lemmatising the words is what turns the cloud from a picture of English grammar into a picture of the document's subject matter.
Word clouds work best as a first-pass exploration tool: glance at the biggest words, form a hypothesis about what the corpus contains. Then verify with actual counts or a more precise visualisation. Treating them as evidence rather than as a prompt for further investigation is the mistake that leads to misleading conclusions. A topic mentioned in every document with moderate frequency will be large. While a topic mentioned heavily in one document and nowhere else may not appear at all, depending on the aggregation.
Run a word cloud on raw English text and you get the, of, and, to, a in enormous type. These are the most frequent words in almost any corpus and they tell you nothing about the subject.
Removing them is what makes the visualisation informative, and it is a genuine editorial choice rather than a technical detail. Standard stopword lists are a reasonable default; domain-specific ones usually matter more. In a corpus of medical papers, patient and study may be so ubiquitous that they crowd out all of it that distinguishes one paper from another.
A word cloud draws each word at a size proportional to how often it appears. That is the whole visualisation: size encodes frequency, and all of it else — colour, rotation, position — is decoration.
Which is worth stating plainly, because it sets both the use and the limits. It answers "what words dominate this text?" quickly and legibly. And it answers nothing else.
The pipeline behind one:
Step 3 is what makes the difference between a useful cloud and a picture of English function words.
from wordcloud import WordCloud
from sklearn.feature_extraction.text import ENGLISH_STOP_WORDS
wc = WordCloud(width=1200, height=600, background_color="white",
stopwords=set(ENGLISH_STOP_WORDS),
max_words=100, collocations=False).generate(text)
wc.to_file("cloud.png")collocations=False is worth knowing: by default the library includes two-word phrases. This is sometimes desirable and often produces duplicated content ("machine", "learning" and "machine learning" all present).
Raw frequency has a systematic bias: it favours words that are common in the language, not words that are distinctive to this text.
Remove stop words and the next tier takes over — "said", "one", "time", "people". A cloud of a thousand product reviews will prominently feature "product". This tells you nothing you did not already know.
TF-IDF weighting fixes this by dividing by how many documents contain each word. So terms appearing everywhere are suppressed and terms distinctive to this document are amplified:
from sklearn.feature_extraction.text import TfidfVectorizer
vec = TfidfVectorizer(stop_words="english", max_features=200)
scores = vec.fit_transform([text]).toarray()[0]
freqs = dict(zip(vec.get_feature_names_out(), scores))
WordCloud().generate_from_frequencies(freqs)generate_from_frequencies is the function to know: it takes any dictionary of word-to-weight. So the sizes can encode TF-IDF, log-odds against a comparison corpus, or a sentiment score. Anything more informative than a raw count.
Word clouds are widely criticised in data visualisation, and the criticisms are correct:
Area is hard to compare. People judge length well and area poorly. So a word twice as frequent does not look twice as prominent. A bar chart of the top 20 terms conveys the same data far more exactly.
Long words look more important. "Implementation" occupies more space than "cost" at the same font size. So word length confounds the encoding.
Position is meaningless but reads as meaningful. Words near the centre appear more important, and the layout algorithm placed them there for packing reasons.
No context or relationships. "Not good" appears as "good". Negation, phrases and sentiment are all invisible.
Rotation hurts legibility for no informational gain.
So the fair summary: a word cloud is a reasonable first look at an unfamiliar corpus and a poor analytical tool. Use it to orient yourself, then use a bar chart, a keyness comparison or a topic model to say anything specific.
Frequency alone conflates “important in this document” with “common broadly”. The standard correction is TF-IDF, which weights a word by how often it appears in this document and divides by how many documents contain it at all:
tf-idf = tf(word, doc) × log(N / df(word))
A word appearing in every document gets an IDF near zero and drops out; a word frequent here and rare elsewhere scores highly. That is much closer to what people actually want a word cloud to show. What is distinctive about this text, not merely what is in it.
The other limitation is that area is a poor visual encoding. People judge length far more accurately than area, so a bar chart conveys the same data more exactly. The word cloud’s advantage is that it is quick to scan and shows many terms at once. Useful for exploration, weak for comparison.
A word cloud encodes frequency as font size and nothing else. Position, colour and rotation are layout, not data. It needs stopword removal to say anything at all, and TF-IDF rather than raw frequency to show what is distinctive rather than merely common. Treat it as a fast exploratory glance at a corpus, and reach for a bar chart when the question is how much bigger one term is than another.
| Question | Better tool |
|---|---|
| Which terms are most frequent? | A horizontal bar chart of the top 20 |
| Which terms distinguish A from B? | Keyness or log-odds ratio, plotted |
| What topics are present? | LDA or BERTopic, with top terms per topic |
| How does usage change over time? | A line chart of term frequency by period |
| Which terms co-occur? | A co-occurrence network graph |
| What is the sentiment? | A sentiment model, not word counts |
The second row deserves emphasis because it is the question people usually mean. Comparing two corpora — positive versus negative reviews, this year versus last — and plotting the terms with the largest difference in relative frequency is far more informative than two word clouds side by side. And it is a standard technique in corpus linguistics.
BERTopic is worth knowing as the modern option: embed the documents, cluster the embeddings, and extract distinguishing terms per cluster. It finds themes rather than words, and it handles the "not good" problem because embeddings are contextual.
Not never — there are cases where it truly fits:
Exploratory orientation. First contact with an unfamiliar corpus, to see what register and subject matter you are dealing with.
Presentation to a non-technical audience, where an at once legible impression matters more than precision. It communicates "here is what this text is about" in one glance.
A visual element in a report or dashboard where the analytical content is carried by other charts.
What to do to make it as good as it can be: remove stop words aggressively, weight by TF-IDF rather than count, disable rotation, cap at 50–100 words, use a single colour or a colour that encodes something real, and put a bar chart of the top terms next to it.
A word cloud is a frequency count with a font size attached. Building one from raw counts and then from TF-IDF shows why the raw version almost always says the same thing no matter the text.
Building on the same setup, the next block shows the remaining cases.
The following block covers the remaining operations.
Are word clouds bad? They are imprecise, which is a real limitation for analysis and not disqualifying for orientation and presentation.
Should I remove stop words? Always, or the cloud shows the structure of the language rather than the content of the text.
Can I use TF-IDF instead of counts? Yes, via generate_from_frequencies, and it usually produces a much more informative cloud.
Does colour mean anything? By default no. You can map it to something real — sentiment, topic, part of speech — and then it does.
How many words should I show? 50–100. Beyond that the small words are unreadable and add nothing.
What about phrases? Bigrams can be included, and watch for the duplication that produces ("machine", "learning", "machine learning").
Say the answer out loud before you reveal it — recalling it is what makes it stick, and rereading it is not.
What is meant by “Stop words are language-specific” here?
What is meant by “Domain stop words matter too” here?
What is meant by “Lemmatise or accept duplicates” here?
What is meant by “Watch for a dominating single term” here?
Paste any text and watch a word cloud size each term by how often it appears, exposing what a document is really about.