Created
April 26, 2018 02:10
-
-
Save charlie86/0a97d1e091863db3299c999bde8232d8 to your computer and use it in GitHub Desktop.
Kid A album art
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# devtools::install_github('charlie86/spotifyr') | |
library(jpeg) | |
library(grid) | |
library(ggplot2) | |
library(spotifyr) | |
library(ggthemes) | |
library(tidyverse) | |
kid_a <- get_artist_audio_features('radiohead') %>% | |
filter(album_name == 'Kid A') %>% | |
mutate(track_number = row_number()) | |
img_url <- kid_a %>% | |
pull(album_img) %>% | |
unique | |
download.file(img_url, 'kida.jpg') | |
db <- readJPEG('kida.jpg') | |
db <- rasterGrob(db, interpolate = TRUE) | |
kid_a %>% | |
ggplot(aes(track_number, danceability)) + | |
annotation_custom(db, xmin = 0, xmax = 12, ymin = 0, ymax = 1) + | |
geom_line(color = 'black', size = 1) + | |
geom_ribbon(aes(ymin = danceability, ymax = 1), fill = '#2d0202') + | |
annotate('text', x = 6, y = .95, | |
label = 'bold("DANCEABILITY BY TRACK")', | |
colour = 'red', | |
size = 8, | |
parse = TRUE) + | |
annotate('text', x = 6, y = 0.8, | |
label = 'bold("KID A")', | |
colour = 'white', | |
parse = TRUE, | |
size = 36) + | |
scale_x_continuous(breaks = kid_a$track_number, | |
labels = kid_a$track_name) + | |
theme_foundation() + | |
theme(axis.text.x = element_text(size = 10, angle = 55, vjust = .95, hjust = .95), | |
axis.title.x = element_blank(), | |
panel.grid.major.x = element_blank() , | |
panel.grid.major.y = element_line( size = 0.1, color = 'black')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment