Get the Data
christmas_songs <- readr::read_csv("https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2019/2019-12-24/christmas_songs.csv")
## Parsed with column specification:
## cols(
## url = col_character(),
## weekid = col_character(),
## week_position = col_double(),
## song = col_character(),
## performer = col_character(),
## songid = col_character(),
## instance = col_double(),
## previous_week_position = col_double(),
## peak_position = col_double(),
## weeks_on_chart = col_double(),
## year = col_double(),
## month = col_double(),
## day = col_double()
## )
christmas_lyrics <- readr::read_tsv("https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2019/2019-12-24/christmas_lyrics.tsv")
## Parsed with column specification:
## cols(
## title = col_character(),
## artist = col_character(),
## songid = col_character(),
## weekid = col_character(),
## track_title = col_character(),
## track_n = col_double(),
## line = col_double(),
## lyric = col_character()
## )
library(ggplot2)
library(dplyr)
##
## 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
labs = tibble(
x = c(2001.5,2005.5,2012.5,2008.5), y = c(33,3.5,7,33),
label = c('My sissy was the reason\n for this billboard hit ',
'My #2 holiday song',
'Christmas songs seem to\nbe ranking in the top 50\nmore often the past 8 years\n(more red dots)',
'2011 was super festive!\nNINE Christmas Songs\n making the top 100')
)
christmas_songs %>%
filter(year >= 1989)%>%
ggplot( aes(year,song))+
geom_point(aes(color = week_position), size = 6)+
labs(title = "HIT CHRISTMAS SONGS SINCE I WAS BORN", y = "",x = "Year the Song Hit Billboard's Top 100")+
scale_color_gradientn(colours = c("darkred","red","darkgreen", "lightgrey"),name = "Billboard\nRank")+
scale_x_continuous(breaks=c(1990, 1995, 2000, 2005, 2010, 2015))+
geom_curve(x = 2004, y = 33, xend = 2001.5, yend = 38, arrow = arrow(length = unit (.2,'cm')), curvature = 0.5)+
geom_curve(x = 2009, y = 3.5, xend = 2010, yend = 4.1, arrow = arrow(length = unit (.2,'cm')), curvature = 0.3)+
geom_curve(x = 2009.5, y = 31, xend = 2010.5, yend = 24, arrow = arrow(length = unit (.2,'cm')), curvature = 0.3)+
geom_label(data = labs, aes(label = label, x = x, y = y), hjust = 0, size = 3, label.size = 0)+
theme_bw()+
theme(title = element_text(colour = "darkred"),
axis.text = element_text(colour = c("darkred","darkgreen")),
panel.border = element_rect(colour = "darkgreen"))
ggsave("20191224_TidyTuesdayWk52_christmassongs.PNG", width = 14, height = 6, units = "in", dpi = 300)