-
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
Dot sizes are inconsistent in faceted quantile dot plots. #191
Comments
Yeah, unfortunately you can't automatically set the same binwidth across facets at the moment. This is due to a limitation of ggplot2: to automatically determine binwidths, we have to know the plot dimensions. However, plot dimensions are not known when graphical objects (grobs) used to display the data are created by ggplot2 geometries. Thus, geom_dots uses a custom grob to draw dotplots that calculates a good binwidth for all the dotplots in a single facet. ggplot2 draws grobs at a facet level, so a single grob can't be used to draw dotplots across multiple facets (so far as I can tell), thus automatic binwidth selection can't be used across facets. (though it does occur to me in writing this that it might be possible to use a hacky approach to layer manipulation to get around the limitations of ggplot2 and allow binwidths to be shared across facets, based on some approaches I used in ggblend... but not sure if/when I'll implement it...) There are some workarounds:
|
Thanks for the response! I am going to try using (1) but automating it by capturing and parsing stdout because it seems like option (2) doesn't do quantile dot plots. Not 100% of the latter. Is that right? |
Option 2 can do quantile dotplots if you construct them manually, which is generally not too much of a pain: e.g., if you have a sample |
That seems like a better solution, but I already have the hackier version of Option 1. Pasting below for others looking for a quick fix.
|
I want to use
stats_dotinterval
in a faceted plot. The variance of the data is different within each facet, but comparing across facets is important. The dots in the lower-variance facets are larger than the dots in the smaller-variance facets. I hope to choosescale
so that the dots are the same size in each facet, and they are as large as they can be while fitting data from all plots in each row.Reproducible example.
Here's the result
As a simple workaround, I can set
binwidth
instats_dotinterval
, but I am making several similar plots with different data and so theirscale
s will be inconsistent.The text was updated successfully, but these errors were encountered: