Skip to content

Instantly share code, notes, and snippets.

@ivelasq
Created February 11, 2020 03:14
Show Gist options
  • Save ivelasq/2ef720fe7138d1399b3315265e61232a to your computer and use it in GitHub Desktop.
Save ivelasq/2ef720fe7138d1399b3315265e61232a to your computer and use it in GitHub Desktop.
library(tidyverse)
library(ggbeeswarm)
library(viridis)
spotify_songs <-
readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2020/2020-01-21/spotify_songs.csv')
spotify_songs %>%
filter(playlist_genre == "pop" & track_popularity > 50) %>%
ggplot(aes(x = playlist_subgenre, y = danceability, group = playlist_subgenre, color = playlist_subgenre)) +
geom_quasirandom(alpha = 0.4) +
ggtitle("Is Dance Pop More Danceable?",
subtitle = "Track Popularity of 50+") +
scale_color_viridis(discrete = T) +
theme_minimal() +
theme(axis.title.x = element_blank(),
legend.position = "none")
spotify_songs %>%
filter(playlist_genre == "pop" & track_popularity > 50) %>%
ggplot(aes(x = playlist_subgenre, y = danceability, group = playlist_subgenre, fill = playlist_subgenre)) +
geom_boxplot() +
ggtitle("Is Dance Pop More Danceable?",
subtitle = "Track Popularity of 50+") +
scale_fill_viridis(discrete = T) +
theme_minimal() +
theme(axis.title.x = element_blank(),
legend.position = "none")
spotify_songs %>%
filter(playlist_genre == "pop" & track_popularity > 50) %>%
ggplot(aes(x = playlist_subgenre, y = danceability, group = playlist_subgenre, fill = playlist_subgenre)) +
geom_boxplot() +
ggtitle("Is Dance Pop More Danceable?",
subtitle = "Track Popularity of 50+") +
scale_fill_viridis(discrete = T) +
theme_minimal() +
theme(axis.title.x = element_blank(),
legend.position = "none")
spotify_songs %>%
filter(playlist_genre == "pop" & track_popularity > 50) %>%
ggplot(aes(x = playlist_subgenre, y = danceability, group = playlist_subgenre, fill = playlist_subgenre)) +
geom_violin() +
geom_boxplot(width = 0.1, fill = "white") +
ggtitle("Is Dance Pop More Danceable?",
subtitle = "Track Popularity of 50+") +
scale_fill_viridis(discrete = T) +
theme_minimal() +
theme(axis.title.x = element_blank(),
legend.position = "none")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment