mjskay / tidybayes

Bayesian analysis + tidy data + geoms (R package)
http://mjskay.github.io/tidybayes
GNU General Public License v3.0
718 stars 59 forks source link

halfeye free y scale with multiple variables #208

Closed fkgruber closed 4 years ago

fkgruber commented 4 years ago

When plotting multiple halfeye plots for different variables the y scale seems to be the same for each of the variable and this leads to very flat distributions in some cases. is it possible to make the density plots independent of the other variables? For example, in the plot for the last 3 variables there is a second mode as shown by the credible interval but it can't be seen by the density plot because of the scaling. image

Thanks FKG

fkgruber commented 4 years ago

just to be extra clear I'm thinking of an option as in facet_wrap where you can do scales='free' vs scales='fixed_y'

for fixed: ggplot(aes(x=HR,fill=Experiment))+geom_density()+facet_wrap(~Experiment,scales='fixed',ncol=1)

image

for free: ggplot(aes(x=HR,fill=Experiment))+geom_density()+facet_wrap(~Experiment,scales='free_y',ncol=1) image

mjskay commented 4 years ago

Yes --- in the dev version of tidybayes (i.e. if you install from github instead of from CRAN) you should be able to get the behavior you want with something like stat_halfeyeh(normalize = "height").

However, I am very likely to change the option names for that argument, as they are pretty opaque currently. In the next version this will likely be something like stat_halfeyeh(normalize = "group"). You can track issue #197 for those changes.

fkgruber commented 4 years ago

thanks. that works

mjskay commented 4 years ago

Great!