Link to the original article containing the graphic recreated: https://projects.fivethirtyeight.com/college-fight-song-lyrics/ - Using the fight_songs data set from the fivethirtyeight package
This figure is a graphical representation of the college fight songs from 65 schools in the Power Five conferences (the ACC, Big Ten, Big 12, Pac-12 and SEC), specifically highlighting Notre Dame. These songs are sung with great pride at sporting events or played by the marching band in support of the college team towards victory. Each college’s fight song is unique bringing all the students together on special occasions. For the version of each song available on Spotify, the tempo and duration was analyzed and plotted.
#install.packages("fivethirtyeight")
library(fivethirtyeight)
## Some larger datasets need to be installed separately, like senators and
## house_district_forecast. To install these, we recommend you install the
## fivethirtyeightdata package by running:
## install.packages('fivethirtyeightdata', repos =
## 'https://fivethirtyeightdata.github.io/drat/', type = 'source')
data(fight_songs)
library(ggplot2)
fightsongs <- fight_songs
#install.packages("dplyr")
library(dplyr)
## Warning: package 'dplyr' was built under R version 4.1.2
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(extrafont)
## Registering fonts with R
## does accuracy of colors matter
ggplot(fightsongs, aes(x=sec_duration, y = bpm, color = school)) +
geom_point(size = 4, alpha = 0.2, show.legend = FALSE) +
ggtitle("How Notre Dame's fight song stacks up") +
theme(plot.title = element_text(hjust=0.5)) +
xlab("Duration") +
ylab("Beats per minute")
secDurmean = fightsongs %>%
summarize(mean_sec_duration = mean(sec_duration, na.rm = TRUE))
BPMmean = fightsongs %>%
summarize(mean_BPM = mean(bpm, na.rm = TRUE))
secDurmean <- secDurmean[[1]]
BPMmean <- BPMmean[[1]]
fight_songs_plot <- ggplot(fightsongs, aes(x=sec_duration, y = bpm, color = school)) +
geom_point(size = 4, alpha = 0.2, show.legend = FALSE) +
ggtitle("How Notre Dame's fight song stacks up") +
xlab("Duration") +
ylab("Beats per minute") +
geom_point(data = fightsongs %>% filter(school == "Notre Dame"), color = "black", size = 4, alpha = 1) +
geom_text(data = fightsongs %>% filter(school == "Notre Dame"), label= "Notre Dame", color = "black", vjust = -1.5, fontface = "bold", size = 3)
fight_songs_plot
fight_songs_plot <- ggplot(fightsongs, aes(x=sec_duration, y = bpm, color = school)) +
geom_point(size = 4, alpha = 0.2, show.legend = FALSE) +
ggtitle("How Notre Dame's fight song stacks up") +
xlab("Duration") +
ylab("Beats per minute") +
geom_point(data = fightsongs %>% filter(school == "Notre Dame"), color = "black", size = 4, alpha = 1) +
geom_text(data = fightsongs %>% filter(school == "Notre Dame"), label= "Notre Dame", color = "black", vjust = -1.5, fontface = "bold", size = 3) +
scale_x_continuous(breaks = seq(0, 180, by = 20), expand = c(0, 0), limits = c(-5, 185), labels=c("0 sec", "20", "40", "60", "80", "100", "120", "140", "160", "180")) +
scale_y_continuous(breaks = seq(60, 200, by = 20), limits = c(55,205), labels=c("60", "80", "100", "120", "140", "160", "180", "200bpm")) +
geom_segment(aes(x = secDurmean, y = 55, xend = secDurmean, yend = 97), color = "black", linetype = "dotted") +
annotate("text", x=71.90769, y=107, label="AVERAGE", angle=90, size = 2) +
geom_segment(aes(x = secDurmean, y = 117, xend = secDurmean, yend = 205), linetype = "dotted", color = "black") +
geom_segment(aes(x = 0, y = BPMmean, xend = 138, yend = BPMmean), color = "black", linetype = "dotted") +
annotate("text", x=145, y=128.8, label="AVERAGE", size = 2) +
geom_segment(aes(x = 154, y = BPMmean, xend = 185, yend = BPMmean), linetype = "dotted", color = "black")
fight_songs_plot
fight_songs_plot <- ggplot(fightsongs, aes(x=sec_duration, y = bpm, color = school)) +
geom_point(size = 4, alpha = 0.2, show.legend = FALSE) +
ggtitle("How Notre Dame's fight song stacks up") +
xlab("Duration") +
ylab("Beats per minute") +
geom_point(data = fightsongs %>% filter(school == "Notre Dame"), color = "black", size = 4, alpha = 1) +
geom_text(data = fightsongs %>% filter(school == "Notre Dame"), label= "Notre Dame", color = "black", vjust = -1.5, fontface = "bold", size = 3) +
scale_x_continuous(breaks = seq(0, 180, by = 20), expand = c(0, 0), limits = c(-5, 185), labels=c("0 sec", "20", "40", "60", "80", "100", "120", "140", "160", "180")) +
scale_y_continuous(breaks = seq(60, 200, by = 20), limits = c(55,205), labels=c("60", "80", "100", "120", "140", "160", "180", "200bpm")) +
geom_segment(aes(x = secDurmean, y = 55, xend = secDurmean, yend = 97), color = "black", linetype = "dotted") +
annotate("text", x=71.90769, y=107, label="AVERAGE", angle=90, size = 2) +
geom_segment(aes(x = secDurmean, y = 117, xend = secDurmean, yend = 205), linetype = "dotted", color = "black") +
geom_segment(aes(x = 0, y = BPMmean, xend = 138, yend = BPMmean), color = "black", linetype = "dotted") +
annotate("text", x=145, y=128.8, label="AVERAGE", size = 2) +
geom_segment(aes(x = 154, y = BPMmean, xend = 185, yend = BPMmean), linetype = "dotted", color = "black") +
annotate("text", x=33, y=192, label= "Fast and short", family = "mono", size = 3.5) +
annotate("text", x = 33, y=58, label = "Slow but short", family = "mono", size = 3.5) +
annotate("text", x=147, y=192, label= "Fast but long", family = "mono", size = 3.5) +
annotate("text", x = 147, y=58, label = "Slow and long", family = "mono", size = 3.5)
fight_songs_plot
fight_songs_plot <- ggplot(fightsongs, aes(x=sec_duration, y = bpm, color = school)) +
geom_point(size = 4, alpha = 0.2, show.legend = FALSE) +
ggtitle("How Notre Dame's fight song stacks up") +
xlab("Duration") +
ylab("Beats per minute") +
geom_point(data = fightsongs %>% filter(school == "Notre Dame"), color = "black", size = 4, alpha = 1) +
geom_text(data = fightsongs %>% filter(school == "Notre Dame"), label= "Notre Dame", color = "black", vjust = -1.5, fontface = "bold", size = 3) +
annotate("text", x=33, y=192, label= "Fast and short", family = "mono", size = 3.5) +
annotate("text", x = 33, y=58, label = "Slow but short", family = "mono", size = 3.5) +
annotate("text", x=147, y=192, label= "Fast but long", family = "mono", size = 3.5) +
annotate("text", x = 147, y=58, label = "Slow and long", family = "mono", size = 3.5) +
scale_x_continuous(breaks = seq(0, 180, by = 20), expand = c(0, 0), limits = c(-5, 185), labels=c("0 sec", "20", "40", "60", "80", "100", "120", "140", "160", "180")) +
scale_y_continuous(breaks = seq(60, 200, by = 20), limits = c(55,205), labels=c("60", "80", "100", "120", "140", "160", "180", "200bpm")) +
geom_segment(aes(x = secDurmean, y = 55, xend = secDurmean, yend = 97), color = "black", linetype = "dotted") +
annotate("text", x=71.90769, y=107, label="AVERAGE", angle=90, size = 2) +
geom_segment(aes(x = secDurmean, y = 117, xend = secDurmean, yend = 205), linetype = "dotted", color = "black") +
geom_segment(aes(x = 0, y = BPMmean, xend = 138, yend = BPMmean), color = "black", linetype = "dotted") +
annotate("text", x=145, y=128.8, label="AVERAGE", size = 2) +
geom_segment(aes(x = 154, y = BPMmean, xend = 185, yend = BPMmean), linetype = "dotted", color = "black") +
theme_bw() +
theme(plot.title = element_text(hjust=0.5, face = "bold"), legend.position='none', axis.text = element_text(face = "plain", family = "Courier New"), aspect.ratio = .8, panel.grid.minor = element_blank(),axis.title = element_text(face= "bold"), panel.border = element_blank(), axis.ticks = element_blank(), panel.grid = element_line(color = "grey")) +
geom_vline(xintercept = 0, size = .2)
fight_songs_plot