0

I am currently trying to use Spotify's API data to show a frequency distribution of all of Taylor Swift's album's song lengths. I am using this code:

pacman::p_load(ggplot2, tidyverse)
ts$duration <- seconds_to_period(ts$duration_ms/1000) # creating new column "duration"

ggplot(ts, aes(x = duration, y = album_name, fill = album_name)) + # The graph
  geom_density_ridges2()

However, when I attempt to run it, I get the following errors:

Picking joint bandwidth of NaN
Warning messages:
1: In min(data$x, na.rm = TRUE) :
  no non-missing arguments to min; returning Inf
2: In max(data$x, na.rm = TRUE) :
  no non-missing arguments to max; returning -Inf
3: Removed 215 rows containing non-finite values (stat_density_ridges). 

Why does ggplot2 not accept lubridate time measurements as an x axis?

  • It's easier to help you if you include a simple [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input and desired output that can be used to test and verify possible solutions. – MrFlick May 02 '22 at 22:54

0 Answers0