metafor icon indicating copy to clipboard operation
metafor copied to clipboard

forest()'s 'colout' option misses out part of the the confidence interval when colouring it in

Open befriendabacterium opened this issue 1 year ago • 2 comments

Classification:

Bug Report

Summary

forest()'s 'colout' option misses out part of the the confidence interval when colouring it in e.g. only colours part of it in green when supposed to colour whole

Reproducible Example (if applicable)

I provide the anonymised input data as an attachment: agg_coloutbug.csv

agg<-read.csv('agg_coloutbug.csv')
res <- metafor::rma(yi_propres, vi_propres, method="EE", data=agg, digits=3)
sav<-metafor::forest(res,
                     efac=c(0,1),
                     at=c(seq(-3,3,1)),
                     alim=c(-1.5,4),
                     xlim=c(-10,6),
                     ilab=cbind(paste(round(agg$intervention_reps)),paste(round(agg$control_reps))),
                     ilab.xpos=c(-4,-2.5),
                     header=TRUE, 
                     xlab='Standardised mean difference',
                     mlab="Overall", 
                     cex=0.7,
                     shade='zebra',
                     colout=res$data$study_colour)

Outputted plot - see Study 3. image

Notes

None.

sessionInfo()

Post output of sessionInfo() below:

R version 4.3.1 (2023-06-16 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19045)

Matrix products: default


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

time zone: Europe/London
tzcode source: internal

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

other attached packages:
 [1] microshades_1.11    ggpubr_0.6.0        orchaRd_2.0         ggridges_0.5.5      ggplot2_3.4.4      
 [6] metafor_4.4-0       numDeriv_2016.8-1.1 metadat_1.2-0       Matrix_1.6-1        patchwork_1.1.3    
[11] dplyr_1.1.4        

loaded via a namespace (and not attached):
  [1] gridExtra_2.3      gld_2.6.6          sandwich_3.0-2     readxl_1.4.3       rlang_1.1.1       
  [6] magrittr_2.0.3     multcomp_1.4-25    polspline_1.1.23   matrixStats_1.0.0  e1071_1.7-13      
 [11] compiler_4.3.1     mgcv_1.8-42        systemfonts_1.0.4  vctrs_0.6.5        quantreg_5.96     
 [16] stringr_1.5.1      pkgconfig_2.0.3    crayon_1.5.2       fastmap_1.1.1      backports_1.4.1   
 [21] labeling_0.4.3     utf8_1.2.4         rmarkdown_2.25     tzdb_0.4.0         ggbeeswarm_0.7.2  
 [26] ragg_1.2.5         MatrixModels_0.5-2 purrr_1.0.2        xfun_0.40          modeltools_0.2-23 
 [31] broom_1.0.5        parallel_4.3.1     cluster_2.1.4      DescTools_0.99.49  R6_2.5.1          
 [36] coin_1.4-2         stringi_1.8.3      car_3.1-2          boot_1.3-28.1      rpart_4.1.19      
 [41] estimability_1.4.1 lmtest_0.9-40      cellranger_1.1.0   Rcpp_1.0.11        knitr_1.45        
 [46] zoo_1.8-12         base64enc_0.1-3    readr_2.1.4        splines_4.3.1      nnet_7.3-19       
 [51] tidyselect_1.2.0   abind_1.4-5        rstudioapi_0.15.0  codetools_0.2-19   lattice_0.21-8    
 [56] tibble_3.2.1       plyr_1.8.8         withr_3.0.0        evaluate_0.23      foreign_0.8-84    
 [61] survival_3.5-5     proxy_0.4-27       pillar_1.9.0       carData_3.0-5      checkmate_2.2.0   
 [66] nortest_1.0-4      stats4_4.3.1       generics_0.1.3     mathjaxr_1.6-0     hms_1.1.3         
 [71] munsell_0.5.0      scales_1.3.0       rootSolve_1.8.2.3  xtable_1.8-4       class_7.3-22      
 [76] glue_1.6.2         emmeans_1.8.8      rms_6.7-0          Hmisc_5.1-0        lmom_2.9          
 [81] tools_4.3.1        gginnards_0.1.2    data.table_1.14.8  SparseM_1.81       ggsignif_0.6.4    
 [86] forcats_1.0.0      Exact_3.2          mvtnorm_1.2-2      cowplot_1.1.1      grid_4.3.1        
 [91] tidyr_1.3.1        rcompanion_2.4.30  libcoin_1.0-9      colorspace_2.1-0   nlme_3.1-162      
 [96] beeswarm_0.4.0     vipor_0.4.5        htmlTable_2.4.1    latex2exp_0.9.6    Formula_1.2-5     
[101] cli_3.6.1          textshaping_0.3.6  fansi_1.0.6        expm_0.999-7       gtable_0.3.4      
[106] rstatix_0.7.2      digest_0.6.33      TH.data_1.1-2      htmlwidgets_1.6.2  farver_2.1.1      
[111] htmltools_0.5.6    lifecycle_1.0.4    httr_1.4.7         multcompView_0.1-9 MASS_7.3-60

befriendabacterium avatar Feb 15 '24 16:02 befriendabacterium

Thanks for reporting this. Indeed, this is because polygon() draws a border by default, which uses the foreground color. Fixing this right now. I cannot immediately push the update as I have a bunch of unfinished updates all sitting in the master branch, but will do so asap.

wviechtb avatar Feb 16 '24 13:02 wviechtb

No prob, thanks for getting on it so fast!

befriendabacterium avatar Feb 16 '24 13:02 befriendabacterium

This is now properly fixed. Thanks for your patience.

wviechtb avatar Mar 04 '24 11:03 wviechtb