Skip to content
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

aesthetics bug when drawing analytical distributions #251

Open
Aorus42 opened this issue Jan 8, 2025 · 0 comments
Open

aesthetics bug when drawing analytical distributions #251

Aorus42 opened this issue Jan 8, 2025 · 0 comments

Comments

@Aorus42
Copy link

Aorus42 commented Jan 8, 2025

During some R sessions I am unable to plot analytical distributions using stat_halfeye, which results in the following error on the example in the stat_halfeye documentation. I wonder if it is clashing with some other package, since I am able to run it in a clean R session with only tidyverse and ggdist loaded.

dist_df = [data.frame](https://rdrr.io/r/base/data.frame.html)(
  group = [c](https://rdrr.io/r/base/c.html)("a", "b", "c"),
  mean =  [c](https://rdrr.io/r/base/c.html)(  5,   7,   8),
  sd =    [c](https://rdrr.io/r/base/c.html)(  1, 1.5,   1)
)

dist_df [%>%](https://magrittr.tidyverse.org/reference/pipe.html)
  [ggplot](https://ggplot2.tidyverse.org/reference/ggplot.html)([aes](https://ggplot2.tidyverse.org/reference/aes.html)(y = group, xdist = [dist_normal](https://pkg.mitchelloharawild.com/distributional/reference/dist_normal.html)(mean, sd))) +
  stat_halfeye()
Error in `layer_slabinterval()`:
! Problem while computing aesthetics.
ℹ Error occurred in the 1st layer.
Caused by error in `check_aesthetics()`:
! Aesthetics must be either length 1 or the same as the data (3).
✖ Fix the following mappings: `xdist`.
Backtrace:
  1. base (local) `<fn>`(x)
  2. ggplot2:::print.ggplot(x)
  4. ggplot2:::ggplot_build.ggplot(x)
  5. ggplot2:::by_layer(...)
 12. ggplot2 (local) f(l = layers[[i]], d = data[[i]])
 13. l$compute_aesthetics(d, plot)
 14. ggdist (local) compute_aesthetics(..., self = self)
 15. ggproto_parent(l, self)$compute_aesthetics(data, plot)
 16. ggplot2 (local) compute_aesthetics(..., self = self)
 17. ggplot2:::check_aesthetics(evaled, n)

Session info:

R version 4.4.1 (2024-06-14 ucrt)
Platform: x86_64-w64-mingw32/x64
Running under: Windows 11 x64 (build 22631)

Matrix products: default


locale:
[1] LC_COLLATE=English_United States.utf8 
[2] LC_CTYPE=English_United States.utf8   
[3] LC_MONETARY=English_United States.utf8
[4] LC_NUMERIC=C                          
[5] LC_TIME=English_United States.utf8    

time zone: America/New_York
tzcode source: internal

attached base packages:
[1] parallel  splines   stats     graphics  grDevices utils     datasets 
[8] methods   base     

other attached packages:
 [1] distributional_0.4.0 ggdist_3.3.2         gamlss_5.4-22       
 [4] gamlss.dist_6.1-1    gamlss.data_6.0-6    bamlss_1.2-4        
 [7] mgcv_1.9-1           nlme_3.1-164         distributions3_0.2.1
[10] colorspace_2.1-1     coda_0.19-4.1        PLNmodels_1.2.0     
[13] tvm_0.5.2            openxlsx_4.2.7.1     lubridate_1.9.3     
[16] forcats_1.0.0        stringr_1.5.1        dplyr_1.1.4         
[19] purrr_1.0.2          readr_2.1.5          tidyr_1.3.1         
[22] tibble_3.2.1         ggplot2_3.5.1        tidyverse_2.0.0     
[25] data.table_1.15.4   

loaded via a namespace (and not attached):
 [1] tidyselect_1.2.1    farver_2.1.2        digest_0.6.36      
 [4] glassoFast_1.0.1    timechange_0.3.0    lifecycle_1.0.4    
 [7] survival_3.6-4      processx_3.8.4      magrittr_2.0.3     
[10] compiler_4.4.1      rlang_1.1.4         tools_4.4.1        
[13] igraph_2.0.3        utf8_1.2.4          corrplot_0.92      
[16] knitr_1.48          labeling_0.4.3      sp_2.1-4           
[19] bit_4.0.5           plyr_1.8.9          xml2_1.3.6         
[22] pkgload_1.4.0       rsconnect_1.3.1     withr_3.0.2        
[25] desc_1.4.3          grid_4.4.1          box_1.2.0          
[28] fansi_1.0.6         future_1.33.2       globals_0.16.3     
[31] scales_1.3.0        MASS_7.3-60.2       mvtnorm_1.2-5      
[34] cli_3.6.3           crayon_1.5.3        ragg_1.3.2         
[37] generics_0.1.3      MBA_0.1-0           rstudioapi_0.16.0  
[40] future.apply_1.11.2 reshape2_1.4.4      tzdb_0.4.0         
[43] coro_1.1.0          vctrs_0.6.5         boot_1.3-30        
[46] Matrix_1.7-0        callr_3.7.6         hms_1.1.3          
[49] patchwork_1.3.0     bit64_4.0.5         Formula_1.2-5      
[52] listenv_0.9.1       systemfonts_1.1.0   glue_1.7.0         
[55] parallelly_1.37.1   nloptr_2.1.1        codetools_0.2-20   
[58] ps_1.7.7            ggtext_0.1.2        stringi_1.8.4      
[61] gtable_0.3.6        munsell_0.5.1       pillar_1.9.0       
[64] pscl_1.5.9          torch_0.13.0        R6_2.5.1           
[67] fim4r_1.8           arules_1.7-9        textshaping_0.4.0  
[70] lattice_0.22-6      gridtext_0.1.5      Rcpp_1.0.13        
[73] zip_2.3.1           gridExtra_2.3       xfun_0.46          
[76] pkgconfig_2.0.3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant