-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consistent y-axis height for stat_dots #26
Comments
This is a really good question to which I would love to be able to answer "yes" 🙂. I like the idea of combining densities with dotplots and dearly wish it was easier... Unfortunately at the moment there's no easy fix. The problem is the automatic bin adjustment on the dotplots needs to be calculated at display time (because it depends on chart size), which can only be done by making the dotplots into their own grob objects (the underlying geometry objects used by {grid}). To coordinate across the dotplots and the densities they would probably all need to be in the same grob object (that, or I'd have to come up with some bizarre hack to coordinate across multiple grobs in a way {grid} is not really designed to do). That would likely require them all to be created in the same geom, or I'd have to add a way to coordinate across geoms as well. So any solution would require non-trivial re-architecting of the internal code and careful thought about what the API should look like. I'm not against this in principle (in fact I've already done this kind of thing several times in tidybayes) but it's definitely not a quick fix, and I'm not even 100% sure it's possible. I'm also not sure exactly what the right relationship between the dotplot scaling and density scaling should be. Happy to take suggestions. So this isn't a "no", because it is a use case I would love to support! It just is not likely to be anytime soon 🙂. Sidebar: in your example since you only have a few samples per group I would use regular old dotplots, not quantile dotplots. If you drop the |
Yeah, I looked at that, but even then it seems quite dependent on the size of the output; it's hard to see how reasonable
Yeah, it's tough when the y-axis scaling in a dotplot is pretty arbitrary. I wonder if something like drawing the sample density curve, then scaling the dots based on that curve might work? Or perhaps scaling the y-axis based on a histogram with the same binwidth as the dotplot? An alternative might be to adjust the .width or scaling of the other geom, e.g., make a histogram that lines up with the dotplot, then use that y-axis scaling for the density curve? |
FYI for getting KDE shape to match a dotplot I might have a slightly better solution now: #178 (comment) |
I love the stat_dots() slab element, especially the quantile version. But it seems to have inherited the major limitation of geom_dotplot() that the linear scale of the y-axis is meaningless.
I'm interested in combining a dots slab with a curve (e.g., to show the observed group distributions against reference normal distributions), but I'm struggling with a way to get consistent y-axis heights for the dots stacks and the density curve, especially across image sizes. See the reprex below.
Is there any way that different slab elements could be forced to use the same linear y-axis scale as the dots slab?
The text was updated successfully, but these errors were encountered: