ggdist icon indicating copy to clipboard operation
ggdist copied to clipboard

check on max bin count conditions for overflow = "compress"

Open mjskay opened this issue 2 years ago • 1 comments

in dot_heap and when overflow = "compress" --- pretty sure this check needs to be adjusted

mjskay avatar Jan 12 '24 05:01 mjskay

The problem is that the overflow = "compress" adjustment doesn't take into account the effective max bin count as calculated in dot_heap(). The right solution might be to optionally return the relevant info from find_dotplot_binwidth() so this check can be done.

An example showing the problem:

data.frame(x = dist_normal(0,1)) |> 
  ggplot(aes(xdist = x)) + 
  stat_dots(quantiles = 250, overflow = "compress", alpha = 0.5, binwidth = 0.5) + 
  geom_hline(yintercept = 0.9)

image

(alternative is to accept that overflow = "compress" is really only designed for when dots get very small, where it already works well).

mjskay avatar Jan 13 '24 03:01 mjskay