ggforce
ggforce copied to clipboard
geom_sina omits data when input/facet has one row
related https://github.com/thomasp85/ggforce/issues/51
reprex:
x <- tibble(grp=c("a", "b", "b", "b", "b"), y=1:5)
ggplot(x, aes(x=grp, y=y)) + geom_sina() # works
x %>% head(n=1) %>% ggplot(aes(x=grp, y=y)) + geom_sina() ## no dots plotted, gives warning
Warning message: Computation failed in
stat_sina()
:binwidth
must be positive
granted that example is silly, but here's how I found the problem
ggplot(x, aes(x=grp, y=y)) + geom_sina() + facet_wrap(~grp, ncol=2) # no dot for grp==a, gives warning
Warning message: Removed 1 rows containing missing values (geom_point).