F1 drivers by nationality till the year 2020

Data :

https://www.kaggle.com/rohanrao/formula-1-world-championship-1950-2020

Code:

library(tidyverse)
dat <- read_csv('drivers.csv')
color_scheme <- c("#E69F00", "#56B4E9", "#009E73", "#F0E442", "#0072B2", "#D55E00", "#CC79A7", "#fdbb84", "#bcbddc", "#a6bddb")dat %>%
group_by(nationality) %>%
count() %>%
filter(n > 20) %>%
ggplot(aes(x = reorder(nationality, n), y = n)) +
geom_bar(aes(fill=nationality), stat = "identity") +
ggtitle("Number of F1 drivers by Nationality (till 2020)") +
xlab("Nationality") +
ylab("Number of drivers") +
coord_flip() +
scale_fill_manual(values = my_scheme) +
geom_text(aes(label = n), size = 4, hjust = 1.5) +
theme(legend.position = "none") +
theme_minimal()
ggsave('f1_plot', device = "png", dpi = 500)

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store