Hi everyone I was looking at some ridgeline plots in R, more specifically in the post "Introduction to ggridges", and my goal is to make this plot but without the overlap:
library(ggplot2)
library(ggridges)
ggplot(iris, aes(x = Sepal.Length, y = Species, fill = 0.5 - abs(0.5 - stat(ecdf)))) +
stat_density_ridges(geom = "density_ridges_gradient", calc_ecdf = TRUE) +
scale_fill_viridis_c(name = "Tail probability", direction = -1)
By reading the same post, the overlap can be added with:
+ geom_density_ridges(scale = 0.9)
but for some reason I got this error:
Error in 0.5 - ecdf : non-numeric argument to binary operator
Thank you