wilkelab / ggridges

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

Warning regarding weights in stat_binline - but they seem to be used? #76

Open LukasWallrich opened 2 years ago

LukasWallrich commented 2 years ago

Last issue from me for today, sorry to keep it coming.

When using weight with stat_binline, a warning states that this aesthetic is ignored. Nevertheless, the output changes, which makes sense since stat_bin supports weights. Now I am not sure whether I can ignore that warning - if so, should the warning be removed?

library(ggridges)
library(ggplot2)

ggplot(mtcars, aes(x=mpg, y=factor(am)))+geom_density_ridges(stat = "binline", aes(weight = cyl))
#> Warning: Ignoring unknown aesthetics: weight
#> `stat_binline()` using `bins = 30`. Pick better value with `binwidth`.

ggplot(mtcars, aes(x=mpg, y=factor(am)))+geom_density_ridges(stat = "binline")
#> `stat_binline()` using `bins = 30`. Pick better value with `binwidth`.

Created on 2022-02-09 by the reprex package (v2.0.1)

clauswilke commented 2 years ago

Honestly I have no idea what is happening here. I would recommend making a simpler example so you can examine whether the weights are actually applied correctly or not.