ggpubr
ggpubr copied to clipboard
Bug with native `geom_boxplot` with `fill` with stats
Dear Alboukadel,
Thank you for developing this very useful package. I found a buggy behavior when plot boxplot with fill
library(ggpubr)
library(rstatix)
stat.test <- ToothGrowth %>% t_test(len ~ supp) %>%
add_xy_position(x = "supp")
# error `Error in FUN(X[[i]], ...) : object 'supp' not found`
ggplot(ToothGrowth, aes(x = supp, y = len, fill = supp)) +
geom_boxplot() +
stat_pvalue_manual(stat.test)
# this will work, without `fill`
ggplot(ToothGrowth, aes(x = supp, y = len)) +
geom_boxplot() +
stat_pvalue_manual(stat.test)
# to use fill, I have to use this
ggboxplot(ToothGrowth, x = "supp", y = "len", fill = "supp") +
stat_pvalue_manual(stat.test)
R version 4.1.2 (2021-11-01)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Rocky Linux 8.5 (Green Obsidian)
Matrix products: default
BLAS: /bigdata/operations/pkgadmin/opt/linux/centos/8.x/x86_64/pkgs/R/4.1.2/lib64/R/lib/libRblas.so
LAPACK: /bigdata/operations/pkgadmin/opt/linux/centos/8.x/x86_64/pkgs/R/4.1.2/lib64/R/lib/libRlapack.so
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] rstatix_0.7.0 ggsignif_0.6.3 ggpubr_0.4.0 hrbrthemes_0.8.0 ggplot2_3.3.5 readr_2.1.2 dplyr_1.0.8 callr_3.7.0 spsUtil_0.2.0 magrittr_2.0.3
[11] stringr_1.4.0 fs_1.5.2 glue_1.6.1
loaded via a namespace (and not attached):
[1] Rcpp_1.0.8 tidyr_1.2.0 ps_1.6.0 assertthat_0.2.1 digest_0.6.29 utf8_1.2.2 R6_2.5.1 backports_1.4.1 evaluate_0.15
[10] httr_1.4.2 pillar_1.7.0 ggfun_0.0.6 yulab.utils_0.0.4 gdtools_0.2.3 rlang_1.0.2 rstudioapi_0.13 car_3.0-12 extrafontdb_1.0
[19] DT_0.20 rmarkdown_2.14 labeling_0.4.2 extrafont_0.17 htmlwidgets_1.5.4 munsell_0.5.0 broom_0.7.12 compiler_4.1.2 xfun_0.31
[28] pkgconfig_2.0.3 systemfonts_1.0.3 gridGraphics_0.5-1 htmltools_0.5.2 tidyselect_1.1.1 tibble_3.1.6 fansi_1.0.2 crayon_1.5.1 tzdb_0.2.0
[37] withr_2.5.0 ggbreak_0.1.0 grid_4.1.2 Rttf2pt1_1.3.10 gtable_0.3.0 lifecycle_1.0.1 DBI_1.1.2 scales_1.2.0 cli_3.2.0
[46] stringi_1.7.6 carData_3.0-5 farver_2.1.0 ellipsis_0.3.2 generics_0.1.2 vctrs_0.3.8 RColorBrewer_1.1-3 tools_4.1.2 ggplotify_0.1.0
[55] purrr_0.3.4 hms_1.1.1 processx_3.5.2 abind_1.4-5 fastmap_1.1.0 yaml_2.3.5 colorspace_2.0-3 aplot_0.1.6 knitr_1.39
[64] patchwork_1.1.1