---
title: "WordCloud"
language: "en"
type: "Symbol"
summary: "WordCloud[{s1, s2, ...}] generates a word cloud graphic in which the si are sized according to their multiplicity in the list. WordCloud[{w1 -> s1, ...}] generates a word cloud in which the si are sized according to the weights wi. WordCloud[<|s1 -> w1, ...|>] also generates a word cloud in which the si are sized according to the weights wi. WordCloud[{w1, w2, ...} -> {s1, s2, ...}] also generates a word cloud in which the si are sized according to the weights wi. WordCloud[{{s1, w1}, {s2, w2}, ...}] also generates a word cloud in which the si are sized according to the weights wi. WordCloud[data, shape] fits the word cloud into the region defined by shape."
keywords: 
- word cloud
- word visualization
- weighted words
- string cloud
- word popularity
- text cloud
- tag cloud
- concept cloud
- tagcloud
- wordcloud
- textcloud
- stringcloud
canonical_url: "https://reference.wolfram.com/language/ref/WordCloud.html"
source: "Wolfram Language Documentation"
related_guides: 
  - 
    title: "Text Analysis"
    link: "https://reference.wolfram.com/language/guide/TextAnalysis.en.md"
  - 
    title: "Natural Language Processing"
    link: "https://reference.wolfram.com/language/guide/NaturalLanguageProcessing.en.md"
  - 
    title: "Data Visualization"
    link: "https://reference.wolfram.com/language/guide/DataVisualization.en.md"
  - 
    title: "Image Composition"
    link: "https://reference.wolfram.com/language/guide/ImageComposition.en.md"
  - 
    title: "String Manipulation"
    link: "https://reference.wolfram.com/language/guide/StringManipulation.en.md"
related_workflows: 
  - 
    title: "Analyze the Text on a Webpage"
    link: "https://reference.wolfram.com/language/workflow/AnalyzeTheTextOnAWebpage.en.md"
related_functions: 
  - 
    title: "ImageCollage"
    link: "https://reference.wolfram.com/language/ref/ImageCollage.en.md"
  - 
    title: "Snippet"
    link: "https://reference.wolfram.com/language/ref/Snippet.en.md"
  - 
    title: "Text"
    link: "https://reference.wolfram.com/language/ref/Text.en.md"
  - 
    title: "Counts"
    link: "https://reference.wolfram.com/language/ref/Counts.en.md"
  - 
    title: "WordCounts"
    link: "https://reference.wolfram.com/language/ref/WordCounts.en.md"
  - 
    title: "LetterCounts"
    link: "https://reference.wolfram.com/language/ref/LetterCounts.en.md"
  - 
    title: "WordFrequency"
    link: "https://reference.wolfram.com/language/ref/WordFrequency.en.md"
  - 
    title: "Tally"
    link: "https://reference.wolfram.com/language/ref/Tally.en.md"
  - 
    title: "ToUpperCase"
    link: "https://reference.wolfram.com/language/ref/ToUpperCase.en.md"
  - 
    title: "ToLowerCase"
    link: "https://reference.wolfram.com/language/ref/ToLowerCase.en.md"
  - 
    title: "StringCases"
    link: "https://reference.wolfram.com/language/ref/StringCases.en.md"
  - 
    title: "TextCases"
    link: "https://reference.wolfram.com/language/ref/TextCases.en.md"
  - 
    title: "WordData"
    link: "https://reference.wolfram.com/language/ref/WordData.en.md"
  - 
    title: "BubbleChart"
    link: "https://reference.wolfram.com/language/ref/BubbleChart.en.md"
---
# WordCloud

WordCloud[{s1, s2, …}] generates a word cloud graphic in which the si are sized according to their multiplicity in the list. 

WordCloud[{w1 -> s1, …}] generates a word cloud in which the si are sized according to the weights wi. 

WordCloud[<|s1 -> w1, …|>] also generates a word cloud in which the si are sized according to the weights wi.

WordCloud[{w1, w2, …} -> {s1, s2, …}] also generates a word cloud in which the si are sized according to the weights wi. 

WordCloud[{{s1, w1}, {s2, w2}, …}] also generates a word cloud in which the si are sized according to the weights wi. 

WordCloud[data, shape] fits the word cloud into the region defined by shape.

## Details and Options

* Word clouds are also known as tag clouds and are often used to visualize popularity of phrases or words in a given context.

* The ``si`` can be strings or any other expression. They are rendered in the word cloud however they would normally be displayed.

* ``WordCloud`` returns a ``Graphics`` object where each object ``si`` is displayed with linear dimensions proportional to its weight.

* ``WordCloud["string"]`` generates a word cloud of the words in ``"string"``.

* Each of the ``si`` can be given a symbol wrapper, which affects its behavior or rendering:

|                       |                                             |
| --------------------- | ------------------------------------------- |
| Annotation[si, label] | provide an annotation                       |
| Button[si, action]    | define an action to execute when clicked    |
| EventHandler[si, …]   | define a general event handler              |
| Hyperlink[si, uri]    | create a hyperlink                          |
| PopupWindow[si, cont] | attach a popup window                       |
| Rotate[si, θi]        | rotate by θi radians                        |
| StatusArea[si, label] | display in the status area when moused over |
| Style[si, …]          | show using the specified styles             |
| Tooltip[si, label]    | attach an arbitrary tooltip                 |

* Data not given in the form above is taken to be missing and will be ignored.

* The cloud shape ``mask`` can be given in the following forms:

|          |                                                |
| -------- | ---------------------------------------------- |
| image    | nonzero pixels of an Image object              |
| graphics | nonzero pixels of a rasterized Graphics object |
| region   | any 2D geometric RegionQ object                |

* ``WordCloud`` has the same options as ``Graphics``, with the following additions and changes: []

|                        |              |                                                      |
| ---------------------- | ------------ | ---------------------------------------------------- |
| Background             | Transparent  | background color to use                              |
| ColorFunction          | Automatic    | color based on weight and word                       |
| ColorFunctionScaling   | True         | whether to scale weight argument of ColorFunction    |
| FontFamily             | "Helvetica"  | the family of font to use                            |
| FontSize               | Automatic    | range of font sizes                                  |
| FontTracking           | "Plain"      | the compression of characters                        |
| FontWeight             | Plain        | the weight of characters to use                      |
| IgnoreCase             | True         | whether to ignore case when computing multiplicities |
| MaxItems               | Automatic    | maximum number of words to show                      |
| PlotRange              | Automatic    | range of values to include                           |
| PlotTheme              | \$PlotTheme  | overall theme for the plot                           |
| PreprocessingRules     | Automatic    | how to pre-process specific elements                 |
| RandomSeeding          | Automatic    | specify the seeding for random word orientation      |
| ScalingFunctions       | Identity     | scaling of the weights                               |
| WordOrientation        | "Horizontal" | orientation of the words to use                      |
| WordSelectionFunction  | Automatic    | function to determine whether to include a word      |
| WordSpacings           | Automatic    | space to add around each word                        |

* With ``ImageSize -> Automatic``, the actual font sizes used are specified by ``FontSize``, and the computed ``ImageSize`` will vary to fit the word cloud.

* With ``ImageSize`` fully specified, rescaled font sizes are used so that the resulting word cloud will fit in the specified image size.

* ``FontSize`` can be used to control font sizes from scaled weights with settings:

|            |                                          |
| ---------- | ---------------------------------------- |
| Automatic  | automatic size range                     |
| max        | explicit max size and automatic min size |
| {min, max} | explicit min and max size                |
| g          | explicit mapping function g  »           |

* ``PreprocessingRules`` can be used to specify how to transform individual words. If the weights are not specified, the preprocessing happens before counting.

* Using ``WordSelectionFunction -> f``, the function ``f`` takes a word as its first argument and that word's weight as its second argument:  »

|               |               |
| ------------- | ------------- |
| #Word or #1   | the word si   |
| #Weight or #2 | the weight wi |

### List of all options

|                        |                 |                                                                                    |
| ---------------------- | --------------- | ---------------------------------------------------------------------------------- |
| AlignmentPoint         | Center          | the default point in the graphic to align with                                     |
| AspectRatio            | Automatic       | ratio of height to width                                                           |
| Axes                   | False           | whether to draw axes                                                               |
| AxesLabel              | None            | axes labels                                                                        |
| AxesOrigin             | Automatic       | where axes should cross                                                            |
| AxesStyle              | {}              | style specifications for the axes                                                  |
| Background             | Transparent     | background color to use                                                            |
| BaselinePosition       | Automatic       | how to align with a surrounding text baseline                                      |
| BaseStyle              | {}              | base style specifications for the graphic                                          |
| ColorFunction          | Automatic       | color based on weight and word                                                     |
| ColorFunctionScaling   | True            | whether to scale weight argument of ColorFunction                                  |
| ContentSelectable      | Automatic       | whether to allow contents to be selected                                           |
| CoordinatesToolOptions | Automatic       | detailed behavior of the coordinates tool                                          |
| Epilog                 | {}              | primitives rendered after the main plot                                            |
| FontFamily             | "Helvetica"     | the family of font to use                                                          |
| FontSize               | Automatic       | range of font sizes                                                                |
| FontTracking           | "Plain"         | the compression of characters                                                      |
| FontWeight             | Plain           | the weight of characters to use                                                    |
| FormatType             | TraditionalForm | the default format type for text                                                   |
| Frame                  | False           | whether to put a frame around the plot                                             |
| FrameLabel             | None            | frame labels                                                                       |
| FrameStyle             | {}              | style specifications for the frame                                                 |
| FrameTicks             | Automatic       | frame ticks                                                                        |
| FrameTicksStyle        | {}              | style specifications for frame ticks                                               |
| GridLines              | None            | grid lines to draw                                                                 |
| GridLinesStyle         | {}              | style specifications for grid lines                                                |
| IgnoreCase             | True            | whether to ignore case when computing multiplicities                               |
| ImageMargins           | 0.              | the margins to leave around the graphic                                            |
| ImagePadding           | All             | what extra padding to allow for labels etc.                                        |
| ImageSize              | Automatic       | the absolute size at which to render the graphic                                   |
| LabelStyle             | {}              | style specifications for labels                                                    |
| MaxItems               | Automatic       | maximum number of words to show                                                    |
| Method                 | Automatic       | details of graphics methods to use                                                 |
| PlotLabel              | None            | an overall label for the plot                                                      |
| PlotRange              | Automatic       | range of values to include                                                         |
| PlotRangeClipping      | False           | whether to clip at the plot range                                                  |
| PlotRangePadding       | Automatic       | how much to pad the range of values                                                |
| PlotRegion             | Automatic       | the final display region to be filled                                              |
| PlotTheme              | \$PlotTheme     | overall theme for the plot                                                         |
| PreprocessingRules     | Automatic       | how to pre-process specific elements                                               |
| PreserveImageOptions   | Automatic       | whether to preserve image options when displaying new versions of the same graphic |
| Prolog                 | {}              | primitives rendered before the main plot                                           |
| RandomSeeding          | Automatic       | specify the seeding for random word orientation                                    |
| RotateLabel            | True            | whether to rotate y labels on the frame                                            |
| ScalingFunctions       | Identity        | scaling of the weights                                                             |
| Ticks                  | Automatic       | axes ticks                                                                         |
| TicksStyle             | {}              | style specifications for axes ticks                                                |
| WordOrientation        | "Horizontal"    | orientation of the words to use                                                    |
| WordSelectionFunction  | Automatic       | function to determine whether to include a word                                    |
| WordSpacings           | Automatic       | space to add around each word                                                      |

---

## Examples (48)

### Basic Examples (3)

Word cloud of weighted strings:

```wl
In[1]:= data = EntityValue[CountryData[], {"Name", "Population"}];

In[2]:= WordCloud[data]

Out[2]= [image]
```

---

Tooltip every word of the word cloud:

```wl
In[1]:= entities = EntityValue[CountryData[], {"Name", "Population"}];

In[2]:= WordCloud[{Tooltip[#[[1]], #[[2]]], #[[2]]}& /@ entities]

Out[2]= [image]
```

---

Create a word cloud using a given shape:

```wl
In[1]:= data = EntityValue[CountryData[], {"Name", "Population"}];

In[2]:= WordCloud[data, [image]]

Out[2]= [image]
```

### Scope (6)

#### Data (4)

Word cloud of a list of strings:

```wl
In[1]:= WordCloud[{"apple", "banana", "grapes", "orange", "grapes", "apple", "grapes", "grapes", "strawberry", "strawberry", "grapes", "grapes", "banana", "apple", "orange", "grapes", "strawberry", "banana", "apple", "grapes"}]

Out[1]= [image]
```

---

Word cloud of a list of strings and weights:

```wl
In[1]:= WordCloud[{{"apple", 4}, {"banana", 3}, {"grapes", 8}, {"orange", 2}, {"strawberry", 3}}]

Out[1]= [image]
```

---

Word cloud of an association:

```wl
In[1]:= WordCloud[<|"apple" -> 4, "banana" -> 3, "grapes" -> 8, "orange" -> 2, "strawberry" -> 3|>]

Out[1]= [image]
```

---

Word cloud of a single string:

```wl
In[1]:= WordCloud["All children, except one, grow up. They soon know that they will grow up, and the way Wendy knew was this. One day when she was two years old she was playing in a garden, and she plucked another flower and ran with it to her mother. I suppose she must have looked rather delightful, for Mrs. Darling put her hand to her heart and cried, \"Oh, why can't you remain like this for ever!\" This was all that passed between them on the subject, but henceforth Wendy knew that she must grow up. You always know after you are two. Two is the beginning of the end."]

Out[1]= [image]
```

#### Shape (1)

Create a word cloud of country names weighted by their area:

```wl
In[1]:= data = EntityValue[CountryData[], {"Name", "Area"}];
```

By default, ``WordCloud`` attempts to create a cloud of a rectangular shape:

```wl
In[2]:= WordCloud[data, ImageSize -> 300]

Out[2]= [image]
```

Define the shape using ``Graphics`` primitives:

```wl
In[3]:= WordCloud[data, Disk[], ImageSize -> 300]

Out[3]= [image]
```

Define the shape as a region:

```wl
In[4]:=
ℛ = RegionDifference[Disk[{3, 3}, 3], Rectangle[{2, 2}, {4, 4}]];
Region[ℛ]

Out[4]= [image]

In[5]:= WordCloud[data, ℛ, ImageSize -> 300]

Out[5]= [image]
```

Use disconnected regions:

```wl
In[6]:=
ℛ = RegionUnion[RegionDifference[Disk[{0, 0}, 3], Disk[{0, 0}, 2]], Disk[{0, 0}, 1]];
Region[ℛ]

Out[6]= [image]

In[7]:= WordCloud[data, ℛ, ImageSize -> 300]

Out[7]= [image]
```

#### Presentation (1)

Words are automatically styled to be distinct:

```wl
In[1]:= data = DeleteMissing[EntityValue[CountryData["Europe"], {"Name", "GDP"}], 1, 1];

In[2]:= WordCloud[data]

Out[2]= [image]
```

Change the font:

```wl
In[3]:= WordCloud[data, FontFamily -> "American Typewriter"]

Out[3]= [image]
```

Change style for a particular word:

```wl
In[4]:= WordCloud[data /. "Germany" -> Style["GERMANY", Bold, Black, FontFamily -> "American Typewriter"]]

Out[4]= [image]
```

Change the color function:

```wl
In[5]:= WordCloud[data, ColorFunction -> ColorData["RustTones"]]

Out[5]= [image]
```

Change the background color:

```wl
In[6]:= WordCloud[data, ColorFunction -> ColorData["RustTones"], Background -> Gray]

Out[6]= [image]
```

Use a plot theme:

```wl
In[7]:= WordCloud[data, PlotTheme -> "Marketing"]

Out[7]= [image]
```

Create a monochrome word cloud:

```wl
In[8]:= WordCloud[data, PlotTheme -> "Monochrome"]

Out[8]= [image]
```

### Options (25)

#### Background (1)

The default background of the word cloud is transparent:

```wl
In[1]:= words = {"One", "fish", "Two", "fish", "Red", "fish", "Blue", "fish", "Black", "fish", "Blue", "fish", "Old", "fish", "New", "fish", "This", "one", "has", "a", "little", "car", "This", "one", "has", "a", "little", "star"};

In[2]:= WordCloud[words]

Out[2]= [image]
```

Specify a different color:

```wl
In[3]:= WordCloud[words, Background -> GrayLevel[.2]]

Out[3]= [image]
```

#### ColorFunction (1)

The default color function is ``ColorData["DarkRainbow"]`` :

```wl
In[1]:= words = {"Humpty", "Dumpty", "sat", "on", "a", "wall", "Humpty", "Dumpty", "had", "a", "great", "fall", "All", "the", "king", "s", "horses", "and", "all", "the", "king", "s", "men", "Couldn", "t", "put", "Humpty", "together", "again"};

In[2]:= WordCloud[words]

Out[2]= [image]
```

Use a custom color function:

```wl
In[3]:= WordCloud[words, ColorFunction -> ColorData["AtlanticColors"]]

Out[3]= [image]
```

Use a single color:

```wl
In[4]:= WordCloud[words, ColorFunction -> Red]

Out[4]= [image]
```

Use shades of a single color:

```wl
In[5]:= WordCloud[words, ColorFunction -> (Blend[{Lighter[Red], Darker[Red]}, #]&)]

Out[5]= [image]
```

Pick random colors from a specified color gradient:

```wl
In[6]:= WordCloud[words, ColorFunction -> (ColorData["DarkRainbow"][RandomReal[]]&)]

Out[6]= [image]
```

#### ColorFunctionScaling (2)

By default, weights are scaled to fit in the range 0 and 1:

```wl
In[1]:= ColorData["Rainbow"]

Out[1]= ColorDataFunction["Rainbow", "Gradients", {0, 1}, Blend["Rainbow", #1] & ]

In[2]:= Table[ColorData["Rainbow"][i], {i, 0, 1, 1 / 6}]

Out[2]= {RGBColor[0.471412, 0.108766, 0.527016], RGBColor[0.246296, 0.31595666666666666, 0.80044], RGBColor[0.324106, 0.6089696666666666, 0.7083413333333334], RGBColor[0.513417, 0.72992, 0.440682], RGBColor[0.764712, 0.7283023333333333, 0.27360833333333334], RGBColor[0.901627, 0.5398719999999999, 0.208366], RGBColor[0.857359, 0.131106, 0.132128]}

In[3]:= WordCloud[Range[7] -> {"one", "two", "three", "four", "five", "six", "seven"}, ColorFunction -> ColorData["Rainbow"]]

Out[3]= [image]
```

---

Scaled weights are not suitable when used with indexed colors:

```wl
In[1]:= ColorData[5]

Out[1]=
ColorDataFunction[5, "Indexed", {1, 10, 1}, 
 {RGBColor[0.4588235294117647, 0.1411764705882353, 0.1411764705882353], 
    RGBColor[0.6274509803921569, 0.23137254901960785, 0.23137254901960785], 
    RGBColor[0.3803921568627451, 0.2784313725490196,  ... r[0.396078431372549, 0.396078431372549, 0.17647058823529413], 
    RGBColor[0.41568627450980394, 0.41568627450980394, 0.3058823529411765], 
    RGBColor[0.6313725490196078, 0.6313725490196078, 0.24705882352941178]}[[
   Mod[Floor[#1], 10, 1]]] & ]

In[2]:= WordCloud[Range[7] -> {"one", "two", "three", "four", "five", "six", "seven"}, ColorFunction -> ColorData[5]]

Out[2]= [image]
```

Use ``ColorFunctionScaling -> False`` :

```wl
In[3]:= WordCloud[Range[7] -> {"one", "two", "three", "four", "five", "six", "seven"}, ColorFunction -> ColorData[5], ColorFunctionScaling -> False]

Out[3]= [image]
```

#### FontFamily (1)

The default font family used is ``"Source Sans Pro"`` :

```wl
In[1]:= WordCloud[Range[7] -> {"one", "two", "three", "four", "five", "six", "seven"}]

Out[1]= [image]
```

Use a different font family:

```wl
In[2]:= WordCloud[Range[7] -> {"one", "two", "three", "four", "five", "six", "seven"}, FontFamily -> "Comic Sans MS"]

Out[2]= [image]
```

#### FontSize (4)

The default font size range is computed automatically:

```wl
In[1]:= WordCloud[Range[7] -> {"one", "two", "three", "four", "five", "six", "seven"}]

Out[1]= [image]
```

---

Rescale to the specified maximum font size:

```wl
In[1]:= WordCloud[Range[7] -> {"one", "two", "three", "four", "five", "six", "seven"}, FontSize -> 50]

Out[1]= [image]
```

---

Rescale the fonts between a minimum and a maximum size:

```wl
In[1]:= WordCloud[Range[7] -> {"one", "two", "three", "four", "five", "six", "seven"}, FontSize -> {40, 60}]

Out[1]= [image]
```

---

Specify a custom mapping between weights and font size:

```wl
In[1]:= cloud = WordCloud[Range[7] -> {"one", "two", "three", "four", "five", "six", "seven"}, FontSize -> (Exp[5 / 8#] + 10&)]

Out[1]= [image]
```

#### FontTracking (1)

The default is ``FontTracking -> "Plain"`` :

```wl
In[1]:=
words = {1 -> "came", 2 -> "during", 1 -> "lunch", 11 -> "now", 1 -> "references", 1 -> "west", 1 -> "wing", 2 -> "episode", 1 -> "tuna", 1 -> "performance", 1 -> "fantasic", 1 -> "hrmm", 1 -> "sure", 1 -> "resist", 1 -> "buying", 2 -> "something", 1 -> "costume", 1 -> "shop", 1 -> "hellz", 2 -> "yeah", 5 -> "good", 3 -> "man", 2 -> "oh", 1 -> "beautiful", 1 -> "representation", 1 -> "funnions", 1 -> "shennanies", 1 -> "wrong", 1 -> "multiplayer", 3 -> "movie", 1 -> "sisters", 4 -> "very", 7 -> "cool", 1 -> "maybe", 21 -> "chocolate", 1 -> "causing", 1 -> "weird", 3 -> "sleep", 1 -> "pattern", 1 -> "although", 2 -> "never", 1 -> "give", 1 -> "harharhar", 2 -> "kinda", 4 -> "fun", 1 -> "looking", 1 -> "past", 1 -> "elections", 1 -> "seeing", 1 -> "certain"};
WordCloud[words, FontTracking -> "Plain"]

Out[1]= [image]
```

Use a more expanded setting:

```wl
In[2]:= WordCloud[words, FontTracking -> "Extended"]

Out[2]= [image]
```

#### FontWeight (1)

The font weight is ``Plain`` by default:

```wl
In[1]:=
words = {1 -> "came", 2 -> "during", 1 -> "lunch", 11 -> "now", 1 -> "references", 1 -> "west", 1 -> "wing", 2 -> "episode", 1 -> "tuna", 1 -> "performance", 1 -> "fantasic", 1 -> "hrmm", 1 -> "sure", 1 -> "resist", 1 -> "buying", 2 -> "something", 1 -> "costume", 1 -> "shop", 1 -> "hellz", 2 -> "yeah", 5 -> "good", 3 -> "man", 2 -> "oh", 1 -> "beautiful", 1 -> "representation", 1 -> "funnions", 1 -> "shennanies", 1 -> "wrong", 1 -> "multiplayer", 3 -> "movie", 1 -> "sisters", 4 -> "very", 7 -> "cool", 1 -> "maybe", 21 -> "chocolate", 1 -> "causing", 1 -> "weird", 3 -> "sleep", 1 -> "pattern", 1 -> "although", 2 -> "never", 1 -> "give", 1 -> "harharhar", 2 -> "kinda", 4 -> "fun", 1 -> "looking", 1 -> "past", 1 -> "elections", 1 -> "seeing", 1 -> "certain"};
WordCloud[words]

Out[1]= [image]
```

Use bold fonts:

```wl
In[2]:= WordCloud[words, FontWeight -> Bold]

Out[2]= [image]
```

#### IgnoreCase (3)

By default, cases are ignored:

```wl
In[1]:= WordCloud[{"Apple", "APPLE"}]

Out[1]= [image]
```

Differentiate between uppercase and lowercase letters:

```wl
In[2]:= WordCloud[{"Apple", "APPLE"}, IgnoreCase -> False]

Out[2]= [image]
```

---

With weighted strings and ``IgnoreCase -> True``, the total weight of the identical words is used:

```wl
In[1]:= WordCloud[{1 -> "Apple", 1 -> "apple", 1 -> "orange"}]

Out[1]= [image]
```

---

With ``IgnoreCase -> True``, each word appears using the capitalization of its first occurrence:

```wl
In[1]:= str = "Apple, apple, orange, Orange";

In[2]:= WordCloud[str]

Out[2]= [image]
```

#### ImageSize (1)

``ImageSize`` controls the display size only. The default display size is computed automatically:

```wl
In[1]:=
str = TextWords@"One fish, Two fish, Red fish, Blue fish,
Black fish, Blue fish, Old fish, New fish.
This one has a littlecar.
This one has a little star.";

In[2]:= WordCloud[str]

Out[2]= [image]
```

Specify a different display size:

```wl
In[3]:= WordCloud[str, ImageSize -> 180]

Out[3]= [image]
```

#### MaxItems (1)

By default, up to 100 elements are shown in the cloud:

```wl
In[1]:= data = AssociationThread[Range[200], Exp[Range[200] / 10.]];

In[2]:= WordCloud[data]

Out[2]= [image]
```

Specify a different amount:

```wl
In[3]:= WordCloud[data, MaxItems -> 20]

Out[3]= [image]

In[4]:= WordCloud[data, MaxItems -> All]

Out[4]= [image]
```

#### PlotTheme (1)

Create a word cloud with a specific theme:

```wl
In[1]:= words = {1 -> "came", 2 -> "during", 1 -> "lunch", 11 -> "now", 1 -> "references", 1 -> "west", 1 -> "wing", 2 -> "episode", 1 -> "tuna", 1 -> "performance", 1 -> "fantasic", 1 -> "hrmm", 1 -> "sure", 1 -> "resist", 1 -> "buying", 2 -> "something", 1 -> "costume", 1 -> "shop", 1 -> "hellz", 2 -> "yeah", 5 -> "good", 3 -> "man", 2 -> "oh", 1 -> "beautiful", 1 -> "representation", 1 -> "funnions", 1 -> "shennanies", 1 -> "wrong", 1 -> "multiplayer", 3 -> "movie", 1 -> "sisters", 4 -> "very", 7 -> "cool", 1 -> "maybe", 21 -> "chocolate", 1 -> "causing", 1 -> "weird", 3 -> "sleep", 1 -> "pattern", 1 -> "although", 2 -> "never", 1 -> "give", 1 -> "harharhar", 2 -> "kinda", 4 -> "fun", 1 -> "looking", 1 -> "past", 1 -> "elections", 1 -> "seeing", 1 -> "certain"};

In[2]:= WordCloud[words, PlotTheme -> "Marketing"]

Out[2]= [image]
```

#### PreprocessingRules (3)

Specify the default processing rules:

```wl
In[1]:= WordCloud[RandomInteger[9, 100], PreprocessingRules -> {n_ ? PrimeQ :> Style[n, Red], n_ :> Style[n, Blue]}]

Out[1]= [image]
```

---

Default styles are used for any word that is not preprocessed:

```wl
In[1]:= WordCloud[RandomInteger[9, 100], PreprocessingRules -> {n_ ? PrimeQ :> Style[n, Red]}]

Out[1]= [image]
```

---

Perform spell correction before displaying strings:

```wl
In[1]:= WordCloud[{"dogg", "bananna", "elefant", "peple"}, PreprocessingRules -> s_String :> First[SpellingCorrectionList[s]]]

Out[1]= [image]
```

#### ScalingFunctions (1)

By default, font sizes are computed directly from the weights:

```wl
In[1]:= data = CountryData[#, "Population"] -> CountryData[#, "Name"]& /@ CountryData[];

In[2]:= WordCloud[data, ImageSize -> 300]

Out[2]= [image]
```

Use logarithmic scaling:

```wl
In[3]:= WordCloud[data, ScalingFunctions -> Log, ImageSize -> 300]

Out[3]= [image]
```

Use inverted weights to highlight countries with small populations:

```wl
In[4]:= WordCloud[data, ScalingFunctions -> (1 / #&), ImageSize -> 300]

Out[4]= [image]
```

#### WordOrientation (1)

A word cloud with random orientations:

```wl
In[1]:= input = ExampleData[{"Text", "AliceInWonderland"}];

In[2]:= WordCloud[input, WordOrientation -> "Random"]

Out[2]= [image]
```

Randomly select from two given orientations:

```wl
In[3]:= WordCloud[input, WordOrientation -> {{0, π / 3}}]

Out[3]= [image]
```

#### WordSelectionFunction (2)

Select strings based on their length:

```wl
In[1]:= WordCloud[RandomWord["KnownWords", 100], WordSelectionFunction -> (StringLength[#] < 6&)]

Out[1]= [image]
```

---

By default, elements are selected based on decreasing weight order up to the ``MaxItems`` value:

```wl
In[1]:= data = CountryData[#, "Population"] -> CountryData[#, "Name"]& /@ CountryData[];

In[2]:= WordCloud[data]

Out[2]= [image]
```

Use a custom selection function:

```wl
In[3]:= WordCloud[data, WordSelectionFunction -> (StringLength[#] == 6&)]

Out[3]= [image]
```

Include the element weight in the selection criterion:

```wl
In[4]:= WordCloud[data, WordSelectionFunction -> Function[{country, population}, StringTake[country, 1] == "G" && population < Quantity[10^7, "People"]]]

Out[4]= [image]
```

#### WordSpacings (1)

By default, a small space is inserted between words to make them more readable:

```wl
In[1]:= input = ToLowerCase@ExampleData[{"Text", "AliceInWonderland"}];

In[2]:= WordCloud[input]

Out[2]= [image]
```

Use minimal spacing:

```wl
In[3]:= WordCloud[input, WordSpacings -> 0]

Out[3]= [image]
```

Specify the spacing:

```wl
In[4]:= WordCloud[input, WordSpacings -> {5, 1}]

Out[4]= [image]
```

### Applications (8)

#### Basic Applications (4)

Summarize a webpage in a word cloud:

```wl
In[1]:= WordCloud[Import["http://www.wolfram.com"]]

Out[1]= [image]
```

---

Summarize a piece of text:

```wl
In[1]:= text = ExampleData[{"Text", "USConstitution"}];

In[2]:= WordCloud[text]

Out[2]= [image]
```

Put selected words in the shape of the US map:

```wl
In[3]:= WordCloud[text, [image], ImageSize -> 400, MaxItems -> 200]

Out[3]= [image]
```

---

Create a word cloud of all artworks of Picasso:

```wl
In[1]:= picassoartwork = EntityValue[Entity["Person", "PabloPicasso::k6djr"], EntityProperty["Person", "NotableArtworks"]];
```

Extract name, area, and an image corresponding to each artwork:

```wl
In[2]:= data = Cases[EntityValue[picassoartwork, {"Name", "Area", "Image"}], {_, _Quantity, _Image}];
```

Create the word cloud and use images as tooltips:

```wl
In[3]:= WordCloud[#[[2]] -> Tooltip[#[[1]], #[[3]]]& /@ data, WordOrientation -> "Random"]

Out[3]= [image]
```

---

Compute and visualize different identifications of an image:

```wl
In[1]:= data = ImageIdentify[[image], Entity["Word", "car"], 10, "Probability"]

Out[1]= <|Entity["Concept", "Convertible::4pxj2"] -> 0.725076, Entity["Concept", "Saloon::y8y52"] -> 0.150854, Entity["Concept", "Coupe::5vr58"] -> 0.0760316, Entity["Concept", "BeachWaggon::c945g"] -> 0.0414006, Entity["Concept", "Hatchback::78j33"] -> 0.00342105, Entity["Concept", "Limo::jfrr3"] -> 0.00153371, Entity["Concept", "Auto::p735c"] -> 1.|>
```

Use probabilities as weights when forming the word cloud:

```wl
In[2]:= WordCloud[data, ImageSize -> Medium]

Out[2]= [image]
```

#### Word Selection (1)

Create a word cloud of nouns longer than two characters:

```wl
In[1]:= input = Import["http://en.wikipedia.org/wiki/Tag_cloud"];
```

Split the input:

```wl
In[2]:= split = TextWords[input];
```

Extract all nouns from a dictionary:

```wl
In[3]:= allnouns = WordData[All, "Noun"];
```

Select input strings that are nouns longer than two characters:

```wl
In[4]:= nouns = Select[split, MemberQ[allnouns, #] && StringLength[#] > 2&];

In[5]:= WordCloud[nouns]

Out[5]= [image]
```

#### Language Analysis (3)

Visualize the frequency of the characters in the built-in dictionary:

```wl
In[1]:=
allcharachters = Characters /@ StringSplit[WordData[All], Except[LetterCharacter]..]//Flatten;
input = Tally[ToLowerCase@allcharachters]

Out[1]= {{"t", 103868}, {"h", 44691}, {"s", 101762}, {"m", 50523}, {"e", 172365}, {"b", 30791}, {"r", 118054}, {"d", 52582}, {"n", 110173}, {"o", 111668}, {"v", 15693}, {"p", 48145}, {"l", 92781}, {"u", 61375}, {"i", 133229}, {"c", 73011}, {"y", 31450}, {"j", 3764}, {"a", 153703}, {"g", 40510}, {"z", 4436}, {"f", 24707}, {"k", 14775}, {"w", 14777}, {"x", 5026}, {"q", 2346}}

In[2]:= WordCloud[input, ColorFunction -> (Blend[{RGBColor[0, 0, 1], RGBColor[1, 0, 0]}, #1]&)]

Out[2]= [image]
```

---

The first 50 trigrams in the English version of the *Aeneid* :

```wl
In[1]:=
trigrams = Tally @* Flatten @* Map[ToLowerCase /* Characters /* (Partition[#, 3, 1]&) /* Map[StringJoin]]@
	StringSplit[ExampleData[{"Text", "AeneidEnglish"}], Except[LetterCharacter]..];

In[2]:= WordCloud[Take[SortBy[trigrams, Last], -50], ColorFunction -> (Blend[{GrayLevel[0.5], GrayLevel[0]}, #1]&)]

Out[2]= [image]
```

---

Word cloud of nouns in a dictionary weighted by their number of synonyms:

```wl
In[1]:= words = Select[WordData[All, "Noun"], (StringMatchQ[#, LetterCharacter..] && StringLength[#] > 4)&];

In[2]:= synonyms = Quiet[DeleteDuplicates@Flatten[WordData[#, "Synonyms"][[All, 2]]]& /@ words];
```

Select words that have at least one synonym:

```wl
In[3]:= selection = DeleteDuplicates[Select[Transpose[{words, synonyms}], Length[#[[2]]] > 0&]];
```

Use the list of synonyms of each word as its tooltip:

```wl
In[4]:= WordCloud[MapThread[{Tooltip[#1, Multicolumn[#2]], N@Log@Length[#2]}&, Transpose[selection]]]

Out[4]= [image]
```

### Properties & Relations (2)

By default, a single string is processed using ``TextWords`` and ``DeleteStopwords`` :

```wl
In[1]:= str = "A tree, an apple, four pears. And more: two sacks";

In[2]:= WordCloud[str]

Out[2]= [image]

In[3]:= WordCloud[TextWords[DeleteStopwords[str]]] == WordCloud[str]

Out[3]= True
```

Explicitly split the words to avoid deletion of stopwords:

```wl
In[4]:= WordCloud[TextWords[str]]

Out[4]= [image]
```

---

By default, the capitalization of words is preserved. With multiple occurrences, the first instance is used:

```wl
In[1]:= str = "To be, or not to be,--that is the question:-- Whether 'tis nobler in the mind to suffer The slings and arrows of outrageous fortune Or to take arms against a sea of troubles, And by opposing end them?--To die,--to sleep,-- No more; and by a sleep to say we end The heartache, and the thousand natural shocks That flesh is heir to,--'tis a consummation Devoutly to be wish'd";

In[2]:= WordCloud[str]

Out[2]= [image]
```

Use all uppercase characters:

```wl
In[3]:= WordCloud[ToUpperCase[str]]

Out[3]= [image]
```

Use all lowercase characters:

```wl
In[4]:= WordCloud[ToLowerCase[str]]

Out[4]= [image]
```

### Possible Issues (1)

By default, stopwords are deleted when a string is used as input:

```wl
In[1]:= str = "My favorite bands are The Who, The The, and Take That.";

In[2]:= WordCloud[str]

Out[2]= [image]
```

Split the string beforehand to keep all the words:

```wl
In[3]:= WordCloud[TextWords[str]]

Out[3]= [image]
```

### Interactive Examples (1)

Word cloud animation of country populations over about three centuries:

```wl
In[1]:= years = Reverse@Range[2014, 1700, -20];

In[2]:=
t = Table[
	Select[Reverse /@ DeleteMissing[Rule@@@EntityValue[CountryData[], {"Name", EntityProperty["Country", "Population", {"Date" -> DateObject[{year}]}]}]], #[[1]] > Quantity[0, "people"]&], 
	{year, years}];

In[3]:=
cfun[weight_, string_] := cfun[_, string] = RandomChoice[ColorData[97, "ColorList"]]
g = MapThread[WordCloud[#, PlotLabel -> Style[Framed[#2], 16, Background -> LightGray], ColorFunction -> cfun, ImageSize -> 300]&, {t, years}];

In[4]:= ListAnimate[g, DefaultDuration -> 2Length[g], AnimationRunning -> False]

Out[4]= DynamicModule[«8»]
```

### Neat Examples (2)

Create a word cloud of HTML colors, using their colors and saturation as the weight:

```wl
In[1]:= WordCloud[(ColorConvert[#[[2]], "HSB"][[2]] -> Style[#[[1]], #[[2]]])& /@ List@@@ColorData["HTML", "ColorRules"], WordOrientation -> "Random"]

Out[1]= [image]
```

Create a psychological Stroop effect:

```wl
In[2]:= WordCloud[(ColorConvert[#[[2]], "HSB"][[2]] -> Style[#[[1]], #[[2]]])& /@ Transpose[MapAt[RotateLeft, Transpose[List@@@ColorData["HTML", "ColorRules"]], {2}]], WordOrientation -> "Random"]

Out[2]= [image]
```

---

Word cloud of an expression:

```wl
In[1]:= expr = HoldForm[ContourPlot3D[Cos[x] Sin[y] + Cos[y] Sin[z] + Cos[z] Sin[x] == 0, {x, -2 π, 2 π}, {y, -2 π, 2 π}, {z, -2 π, 2 π}, ContourStyle -> Directive[FaceForm[Orange, Red], Specularity[White, 30]], Mesh -> None]];

In[2]:= WordCloud[StringSplit[ToString[expr], Except[WordCharacter]..], ColorFunction -> ColorData["GrayTones"]]

Out[2]= [image]
```

## See Also

* [`ImageCollage`](https://reference.wolfram.com/language/ref/ImageCollage.en.md)
* [`Snippet`](https://reference.wolfram.com/language/ref/Snippet.en.md)
* [`Text`](https://reference.wolfram.com/language/ref/Text.en.md)
* [`Counts`](https://reference.wolfram.com/language/ref/Counts.en.md)
* [`WordCounts`](https://reference.wolfram.com/language/ref/WordCounts.en.md)
* [`LetterCounts`](https://reference.wolfram.com/language/ref/LetterCounts.en.md)
* [`WordFrequency`](https://reference.wolfram.com/language/ref/WordFrequency.en.md)
* [`Tally`](https://reference.wolfram.com/language/ref/Tally.en.md)
* [`ToUpperCase`](https://reference.wolfram.com/language/ref/ToUpperCase.en.md)
* [`ToLowerCase`](https://reference.wolfram.com/language/ref/ToLowerCase.en.md)
* [`StringCases`](https://reference.wolfram.com/language/ref/StringCases.en.md)
* [`TextCases`](https://reference.wolfram.com/language/ref/TextCases.en.md)
* [`WordData`](https://reference.wolfram.com/language/ref/WordData.en.md)
* [`BubbleChart`](https://reference.wolfram.com/language/ref/BubbleChart.en.md)

## Related Guides

* [Text Analysis](https://reference.wolfram.com/language/guide/TextAnalysis.en.md)
* [Natural Language Processing](https://reference.wolfram.com/language/guide/NaturalLanguageProcessing.en.md)
* [Data Visualization](https://reference.wolfram.com/language/guide/DataVisualization.en.md)
* [Image Composition](https://reference.wolfram.com/language/guide/ImageComposition.en.md)
* [String Manipulation](https://reference.wolfram.com/language/guide/StringManipulation.en.md)

## Related Workflows

* [Analyze the Text on a Webpage](https://reference.wolfram.com/language/workflow/AnalyzeTheTextOnAWebpage.en.md)

## Related Links

* [An Elementary Introduction to the Wolfram Language: Strings and Text](https://www.wolfram.com/language/elementary-introduction/11-strings-and-text.html)
* [An Elementary Introduction to the Wolfram Language: Options](https://www.wolfram.com/language/elementary-introduction/20-options.html)
* [An Elementary Introduction to the Wolfram Language: Natural Language Understanding](https://www.wolfram.com/language/elementary-introduction/35-natural-language-understanding.html)
* [An Elementary Introduction to the Wolfram Language: Datasets](https://www.wolfram.com/language/elementary-introduction/45-datasets.html)

## History

* [Introduced in 2015 (10.1)](https://reference.wolfram.com/language/guide/SummaryOfNewFeaturesIn101.en.md) \| [Updated in 2016 (11.0)](https://reference.wolfram.com/language/guide/SummaryOfNewFeaturesIn110.en.md) ▪ [2017 (11.2)](https://reference.wolfram.com/language/guide/SummaryOfNewFeaturesIn112.en.md)