wilkelab / ggridges

Ridgeline plots in ggplot2
https://wilkelab.org/ggridges
GNU General Public License v2.0
412 stars 31 forks source link

Feature request: `geom_density_ridges` for bounded data #85

Open wbvguo opened 1 year ago

wbvguo commented 1 year ago

Hi,

Thanks for maintaining this tool. Would it be possible to have an option for setting bounds when plotting the density ridge plot?

Just as the geom_density did in this github post:

https://github.com/tidyverse/ggplot2/issues/3387

Thanks!

rimonim commented 9 months ago

I agree that this would be a nice feature. Until it gets implemented, I'll note that the effect can be pretty easily achieved by setting stat to "density" (remember to add height = ..density..)

For example: ggplot(diamonds, aes(x = price, y = cut, fill = cut, height = ..density..)) + geom_density_ridges(stat = "density", bounds = c(0, 20000))