Heatmap showing swearword usage in movies
For this last example, we're going to create a heatmap that shows how often swear words are used in movies. We're going to create a heatmap that looks like this:

In this figure, the colors show how often someone swears in that specific part of the movie. For this example, the movie is divided into 30 second segments. The numbers at the left side show how far in the movie we are, and the legend at the bottom shows the color coding used.
The first thing we need, though, is some data to visualize.
Preparing the data
The easiest way to determine the amount of swearing in a movie is by analyzing the subtitles. For most popular movies, you can download a subtitle file (in .srt
format), which shows the time of a specific sentence and all the words. For instance, the start of the subtitle file for The Big Lebowski looks like this:
1 00:00:41,500 --> 00:00:44,127 Way out West there was this fella. 2 00:00:44,211 --> 00:00:46,546 Fella I wanna tell...