Skip to content

Instantly share code, notes, and snippets.

@cavedave
Last active May 29, 2018 17:02
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save cavedave/c7c6f15a49ca4a5fce6232bb40b07b19 to your computer and use it in GitHub Desktop.
Save cavedave/c7c6f15a49ca4a5fce6232bb40b07b19 to your computer and use it in GitHub Desktop.
loudness of songs joyplot. Data from https://twitter.com/kcimc/status/893855561590157312
loud <-read.csv(file="loudness.csv",sep="\t",header=TRUE)
loud <- subset(loud, select = -c(X) )
loud<-filter(loud, year >= 16)
loud<-filter(loud,loudness >-40)
#loud<-filter(time, duration > 20)
head(loud)
min = min(loud$loudness)
max = max(loud$loudness)
#min_tempo = min(df$year)
#max_tempo = max(df$year)
print(max)
print(min)
loud["decade"] <- loud["year"] - (loud["year"]%% 10)
head(loud)
#summary(df)
#ggplot(df,aes(x = loudness,y = year,height=..density..))+
# geom_joy(scale=3) +
# scale_y_reverse(breaks=c(2000, 1980, 1960, 1940, 1920, 1900), expand = c(0.01, 0))+
# scale_x_continuous(limits = c(min,max))+
# theme_joy()
ggplot(loud, aes(x = loudness, y = decade, group = decade))+
geom_joy2()+
labs(title = 'Loudness of Songs',subtitle='by @iamreddave',
x="Loudness db.",y="")+
scale_x_continuous(limits=c(-40, 4.2), expand = c(0.01, 0)) +
scale_y_reverse(breaks=c(2000, 1980, 1960, 1940, 1920, 1900), expand = c(0.01, 0))+
theme_joy()
ggsave("loud.png")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment