A Word Cloud or Tag Cloud is a graphical representation of word frequency within a text: the more often a word is used in a text, the bigger and bolder it is represented in a graph. It can be a useful tool to communicate at a glance the most important keywords in a particular text or topic in a effective and fun way.
In this tutorial we will create a Word Cloud from a sample of nameless tweets extracted from Twitter for the period 3/16/2020 - 08/31/2020 in Peru. The dataset was modificated to respect Twitter private information policy and is used just as an example to show how to create a Word Cloud.
We will do different examples of Word Clouds by using the following steps:
- Install packages and import libraries
- Import the dataset, clean it up and select the text you are going to work with (tweets)
- Perform the text preprocessing and create a clean variable
- Create your Word Cloud:
- Example 1: Default model
- Example 2: Default model - customize parameters
- Example 3: Customize shapes
- Example 4: Customize colors - set multiple colors with a mask
- Example 5: Customize colors - set a single color with a mask
- Example 6: Customize colors - set multiple colors with a function
- Example 7: Customize content - set repeated words
- Example 8: Customize content - set non-repeated words
- Finally, you can review Bibliography to look for more information..