thomasp85 / ggforce

Accelerating ggplot2
https://ggforce.data-imaginist.com
Other
917 stars 105 forks source link

Geom_sina() fails for 'high' values #96

Closed JAQuent closed 5 years ago

JAQuent commented 6 years ago

I tried to plot RT data with geom_sina() but it fail to introduce any jitter.

mean1 <- 1000
sd1   <- 100
n     <- 1000
simData <- data.frame(group = rep(c('A', 'B'), n), 
                      value = c(rnorm(n, mean1, sd1), rnorm(n, mean1, sd1)))
ggplot(simData, aes(y = value, x = group)) + geom_sina()

It only works if I make the values smaller: ggplot(simData, aes(y = value/100, x = group)) + geom_sina()

Is this a bug? I tried to play with bins or binwidth but I didn't succeed.

sidiropoulos commented 6 years ago

Hi @JAQuent,

I'm finding it hard to reproduce the bug.

ggplot(simData, aes(y = value, x = group)) + geom_sina()

image

Could you post your sessionInfo() output?

JAQuent commented 6 years ago

R version 3.4.2 (2017-09-28) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

locale: [1] LC_COLLATE=English_United Kingdom.1252 LC_CTYPE=English_United Kingdom.1252
[3] LC_MONETARY=English_United Kingdom.1252 LC_NUMERIC=C
[5] LC_TIME=English_United Kingdom.1252

attached base packages: [1] grid stats graphics grDevices utils datasets methods base

other attached packages: [1] memoryROC_0.0.1.0 ggsignif_0.4.0 reshape2_1.4.3 gridExtra_2.3 plyr_1.8.4
[6] ggforce_0.1.1 ggplot2_2.2.1 lmerTest_3.0-1 lme4_1.1-17 Matrix_1.2-11

loaded via a namespace (and not attached): [1] tidyselect_0.2.4 purrr_0.2.4 splines_3.4.2 lattice_0.20-35
[5] colorspace_1.3-2 htmltools_0.3.6 yaml_2.1.19 base64enc_0.1-3
[9] survival_2.41-3 rlang_0.2.0 nloptr_1.0.4 pillar_1.2.2
[13] foreign_0.8-69 glue_1.2.0 tweenr_0.1.5 RColorBrewer_1.1-2 [17] bindrcpp_0.2.2 bindr_0.1.1 stringr_1.3.1 munsell_0.4.3
[21] gtable_0.2.0 htmlwidgets_1.2 evaluate_0.10.1 labeling_0.3
[25] latticeExtra_0.6-28 knitr_1.20 htmlTable_1.11.2 Rcpp_0.12.16
[29] acepack_1.4.1 udunits2_0.13 scales_0.5.0 backports_1.1.2
[33] checkmate_1.8.5 jsonlite_1.5 Hmisc_4.1-1 digest_0.6.15
[37] stringi_1.1.7 dplyr_0.7.5.9000 rprojroot_1.3-2 numDeriv_2016.8-1
[41] tools_3.4.2 magrittr_1.5 lazyeval_0.2.1 tibble_1.4.2
[45] Formula_1.2-3 cluster_2.0.6 pkgconfig_2.0.1 MASS_7.3-47
[49] data.table_1.11.2 rmarkdown_1.9 assertthat_0.2.0 minqa_1.2.4
[53] rstudioapi_0.7 R6_2.2.2 rpart_4.1-11 units_0.5-1
[57] nnet_7.3-12 nlme_3.1-131 compiler_3.4.2

sidiropoulos commented 6 years ago

I managed to reproduce the bug by installing the CRAN version of ggforce. The plot behaves as it should for both "high" and low values in the dev version. Unless it's an issue I would suggest to install that one instead.

devtools::install_github("thomasp85/ggforce")

It's a bit misleading that both the CRAN and github versions are on v0.1.1. @thomasp85 maybe it's a good idea to have the git version bumped up?