Make a dots_mcse geom and/or mcse histogram geom
Would need to be on a separate branch or maybe even separate package for now, but idea would be: use ggfx to make a horizontal blur with SD = MCSE on each dot in a quantile dotplot
Another option might be an oblong shape or even interval kind of thing around the dot.
- [x]
geom_blur_dots()andstat_mcse_dots()- [ ] put something in a vignette?
- [x] quantile-based histograms (maybe a
breaks_quantiles()function?)- [ ] put something in a vignette?
see also this stuff, including histogram ideas: https://github.com/mjskay/uncertainty-examples/blob/master/mcse_dotplots.md
You thinking a separate branch to avoid the ggfx dependency? Could do that in Suggests?
I had a separate branch where I was playing with a ggfx approach but it turned out not to really do what I wanted as easily as I thought it would and I abandoned that.
The examples I tried on Twitter just overlaid a bunch of dotplots, which was fine as a quick demo but isn't really a good longterm solution since the blurring really should be happening at a dot level after the layout algorithm runs (you can see in the demo this occasionally causes issues of ghost dots due to the layout resulting in an ever so slightly different binning on occasion)
I think a better way might be to use the new gradient support in R 4.1 to construct a blurred shape of some kind, probably as a separate grob and geom from the main dots geom (or a particular option) since it wouldn't work with arbitrary shapes.
Anyway if someone want to play with this on a branch I'd be happy to entertain it!
Implementing this on branch blur_dot_r41_3 and it's fun to play with. Here's a gamma distribution coming into focus:
set.seed(1234)
x = rgamma(10000, 2, 2)
p = ppoints(1000)
data.frame(
q = quantile(x, p),
se = posterior::mcse_quantile(x, p)
) |>
ggplot() +
geom_blurdots(aes(x = q, blur = se), layout = "weave") +
theme_ggdist()
Will add something like stat_mcse_dots() wrapping up the quantile + mcse transformation above too.