Is there a way to plot densities over a time series? I'm looking for something like this:
Asked
Active
Viewed 89 times
-4
-
Post some data, and show what you have tried. [In other words](https://stackoverflow.com/help/mcve) – missuse Feb 24 '18 at 15:59
-
[check this](https://cran.r-project.org/web/packages/ggridges/vignettes/introduction.html) – erocoar Feb 24 '18 at 16:06
1 Answers
0
Claus Wilke has some great examples of exactly this in the vignettes of the ggridges package. Here's a reproducible one illustrating how it's done:
library(ggridges)
library(ggplot2movies)
ggplot(movies[movies$year>1912,], aes(x = length, y = year, group = year)) +
geom_density_ridges(scale = 10, size = 0.25, rel_min_height = 0.03) +
theme_ridges() +
scale_x_continuous(limits=c(1, 200), expand = c(0.01, 0)) +
scale_y_reverse(breaks=c(2000, 1980, 1960, 1940, 1920, 1900), expand = c(0.01, 0))
Film Lengths by Year

merv
- 67,214
- 13
- 180
- 245