How To Create An ANIMATED Bar Chart Race

Опубликовано: 10 Август 2026
на канале: Dean Chereden
2,397
51

In this video, I show you how to create an animated bar chart race using gganimate.

#rstat #dataanalyst #rstudio


📁 Dataset
https://data.world/deanchereden/f1-da...

📁 Hex Codes
https://data.world/deanchereden/f1-da...

📁 Rscript file
https://data.world/deanchereden/f1-da...

📁 Logo PNGs
https://data.world/deanchereden/f1-da...


🔖c h a p t e r s 🔖

00:00 - Intro
00:28 - Install packages
01:39 - Load in data
03:08 - Format date to date format
03:44 - Sort race date by ascending
04:19 - Create a cumulative sum of wins
05:30 - Group by date & team to get the total sum
07:06 - Pivot the data
09:19 - Unpivot the data
11:10 - Create a rank column
13:21 - Add images via an image column
14:57 - Add hex codes column using join
16:11 - Add year column
16:37 - Create the bar chart in ggplot
17:13 - Set up x & y axis
18:13 - Add background image
19:18 - Set chart as bar & add hex codes
20:48 - Add year text to bottom right
22:40 - Flip bar chart to its side
23:21 - Change order - show most wins at top
23:34 - Add constructor names
24:33 - Format the theme of the plot
25:57 - Adjust the plots margin
26:40 - Add background color to plot
26:53 - Format title, subtitle & caption
27:56 - Add images to end of bars
29:02 - Add data labels after images
31:07 - Run chart ready to animate
31:45 - Create animation
36:15 - Export as a gif
36:36 - Change size, fps, duration & render
39:40 - Export to mp4


My RStudio Appearance Setup

RStudio theme: Modern
Zoom: 100%
Editor font: Lucida Console
Text rendering: (Default)
Editor font size: 16
Editor theme: Tomorrow Night 80s

To learn how to change your appearance in RStudio here:    • How to Download R & R Studio, Run R Studio...  


Contact and Socials

💌 My email - [email protected]
🌍 My website - https://www.deanchereden.com
🐦 Twitter -   / deanchereden  


Music

🎶 Cloudchord, G Mills - Cruisin' https://chll.to/ec196055

🎶 Listen to Chillhop Music -    • Misha & Jussi Halme - Bliss (A Felicidade)...