F1 drivers by nationality till the year 2020

Nitesh Turaga
Mar 26, 2021

--

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)

--

--

No responses yet