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

ggforest output not visible in rmarkdown #321

Closed
grvsinghal opened this issue Jul 5, 2018 · 4 comments
Closed

ggforest output not visible in rmarkdown #321

grvsinghal opened this issue Jul 5, 2018 · 4 comments

Comments

@grvsinghal
Copy link

Expected behavior

When I execute ggforest in R-markdown, the plot should get rendered

Actual behavior

No graph shows up

Steps to reproduce the problem

library(ggplot2)
library(survival)
library(survminer)

data("veteran")
cox = coxph(Surv(time, status) ~ karno+celltype, data = veteran)
ggforest(cox, data = veteran)
# please paste here the result of
devtools::session_info()
Session info ------------------------------------------------------------------------------------------------
 setting  value                       
 version  R version 3.4.4 (2018-03-15)
 system   x86_64, mingw32             
 ui       RStudio (1.1.442)           
 language (EN)                        
 collate  English_United States.1252  
 tz       Asia/Calcutta               
 date     2018-07-05                  

Packages ----------------------------------------------------------------------------------------------------
 package    * version   date       source        
 assertthat   0.2.0     2017-04-11 CRAN (R 3.4.4)
 base       * 3.4.4     2018-03-15 local         
 bindr        0.1.1     2018-03-13 CRAN (R 3.4.4)
 bindrcpp     0.2.2     2018-03-29 CRAN (R 3.4.4)
 broom        0.4.5     2018-07-03 CRAN (R 3.4.4)
 cmprsk       2.2-7     2014-06-17 CRAN (R 3.4.4)
 colorspace   1.3-2     2016-12-14 CRAN (R 3.4.4)
 compiler     3.4.4     2018-03-15 local         
 data.table   1.11.4    2018-05-27 CRAN (R 3.4.4)
 datasets   * 3.4.4     2018-03-15 local         
 devtools     1.13.5    2018-02-18 CRAN (R 3.4.3)
 digest       0.6.15    2018-01-28 CRAN (R 3.4.3)
 dplyr        0.7.5     2018-05-19 CRAN (R 3.4.4)
 foreign      0.8-69    2017-06-22 CRAN (R 3.4.4)
 ggplot2    * 2.2.1     2016-12-30 CRAN (R 3.4.4)
 ggpubr     * 0.1.6     2017-11-14 CRAN (R 3.4.4)
 glue         1.2.0     2017-10-29 CRAN (R 3.4.4)
 graphics   * 3.4.4     2018-03-15 local         
 grDevices  * 3.4.4     2018-03-15 local         
 grid         3.4.4     2018-03-15 local         
 gridExtra    2.3       2017-09-09 CRAN (R 3.4.4)
 gtable       0.2.0     2016-02-26 CRAN (R 3.4.4)
 km.ci        0.5-2     2009-08-30 CRAN (R 3.4.4)
 KMsurv       0.1-5     2012-12-03 CRAN (R 3.4.1)
 knitr        1.20      2018-02-20 CRAN (R 3.4.4)
 labeling     0.3       2014-08-23 CRAN (R 3.4.1)
 lattice      0.20-35   2017-03-25 CRAN (R 3.4.4)
 lazyeval     0.2.1     2017-10-29 CRAN (R 3.4.4)
 magrittr   * 1.5       2014-11-22 CRAN (R 3.4.4)
 Matrix       1.2-12    2017-11-30 CRAN (R 3.4.4)
 memoise      1.1.0     2017-04-21 CRAN (R 3.4.4)
 methods    * 3.4.4     2018-03-15 local         
 mnormt       1.5-5     2016-10-15 CRAN (R 3.4.1)
 munsell      0.4.3     2016-02-13 CRAN (R 3.4.4)
 nlme         3.1-131.1 2018-02-16 CRAN (R 3.4.4)
 parallel     3.4.4     2018-03-15 local         
 pillar       1.2.3     2018-05-25 CRAN (R 3.4.4)
 pkgconfig    2.0.1     2017-03-21 CRAN (R 3.4.4)
 plyr         1.8.4     2016-06-08 CRAN (R 3.4.4)
 psych        1.8.4     2018-05-06 CRAN (R 3.4.4)
 purrr        0.2.5     2018-05-29 CRAN (R 3.4.4)
 R6           2.2.2     2017-06-17 CRAN (R 3.4.4)
 Rcpp         0.12.16   2018-03-13 CRAN (R 3.4.4)
 reshape2     1.4.3     2017-12-11 CRAN (R 3.4.4)
 rlang        0.2.1     2018-05-30 CRAN (R 3.4.4)
 scales       0.5.0     2017-08-24 CRAN (R 3.4.4)
 splines      3.4.4     2018-03-15 local         
 stats      * 3.4.4     2018-03-15 local         
 stringi      1.1.7     2018-03-12 CRAN (R 3.4.4)
 stringr      1.3.1     2018-05-10 CRAN (R 3.4.4)
 survival   * 2.41-3    2017-04-04 CRAN (R 3.4.4)
 survminer  * 0.4.2     2018-01-31 CRAN (R 3.4.4)
 survMisc     0.5.5     2018-07-05 CRAN (R 3.4.4)
 tibble       1.4.2     2018-01-22 CRAN (R 3.4.4)
 tidyr        0.8.1     2018-05-18 CRAN (R 3.4.4)
 tidyselect   0.2.4     2018-02-26 CRAN (R 3.4.4)
 tools        3.4.4     2018-03-15 local         
 utils      * 3.4.4     2018-03-15 local         
 withr        2.1.2     2018-03-15 CRAN (R 3.4.4)
 xtable       1.8-2     2016-02-05 CRAN (R 3.4.4)
 yaml         2.1.19    2018-05-01 CRAN (R 3.4.4)
 zoo          1.8-1     2018-01-08 CRAN (R 3.4.4)
@kassambara
Copy link
Owner

This issue is not reproducible on my computer.

Session info ---------------------------------------------------------------------------------------------------------------------
 setting  value                       
 version  R version 3.3.2 (2016-10-31)
 system   x86_64, darwin13.4.0        
 ui       RStudio (1.1.423)           
 language (EN)                        
 collate  fr_FR.UTF-8                 
 tz       Europe/Paris                
 date     2018-07-07                  

Packages -------------------------------------------------------------------------------------------------------------------------
 package    * version    date       source                               
 assertthat   0.2.0.9000 2017-11-08 Github (hadley/assertthat@37f0a56)   
 base       * 3.3.2      2016-10-31 local                                
 bindr        0.1        2016-11-13 cran (@0.1)                          
 bindrcpp     0.2        2017-06-17 cran (@0.2)                          
 broom        0.4.3      2017-11-20 cran (@0.4.3)                        
 cmprsk       2.2-7      2014-06-17 CRAN (R 3.3.0)                       
 colorspace   1.4-0      2017-10-23 url                                  
 data.table   1.10.4     2017-02-01 cran (@1.10.4)                       
 datasets   * 3.3.2      2016-10-31 local                                
 devtools   * 1.13.1     2017-05-13 CRAN (R 3.3.2)                       
 digest       0.6.15     2018-01-28 cran (@0.6.15)                       
 dplyr        0.7.4      2017-09-28 cran (@0.7.4)                        
 foreign      0.8-67     2016-09-13 CRAN (R 3.3.2)                       
 ggplot2    * 2.2.1.9000 2018-06-30 Github (tidyverse/ggplot2@348b26f)   
 ggpubr     * 0.1.7.999  2018-06-30 local (kassambara/ggpubr@8f7fa67)    
 glue         1.2.0      2017-10-29 cran (@1.2.0)                        
 graphics   * 3.3.2      2016-10-31 local                                
 grDevices  * 3.3.2      2016-10-31 local                                
 grid         3.3.2      2016-10-31 local                                
 gridExtra    2.3        2017-09-09 cran (@2.3)                          
 gtable       0.2.0      2016-02-26 CRAN (R 3.3.0)                       
 km.ci        0.5-2      2009-08-30 CRAN (R 3.3.0)                       
 KMsurv       0.1-5      2012-12-03 CRAN (R 3.3.0)                       
 knitr        1.18       2017-12-27 cran (@1.18)                         
 labeling     0.3        2014-08-23 CRAN (R 3.3.0)                       
 lattice      0.20-34    2016-09-06 CRAN (R 3.3.2)                       
 lazyeval     0.2.1      2017-10-29 cran (@0.2.1)                        
 magrittr   * 1.5        2014-11-22 CRAN (R 3.3.0)                       
 Matrix       1.2-11     2017-08-16 CRAN (R 3.3.2)                       
 memoise      1.1.0      2017-04-21 cran (@1.1.0)                        
 methods    * 3.3.2      2016-10-31 local                                
 mnormt       1.5-5      2016-10-15 CRAN (R 3.3.0)                       
 munsell      0.4.3      2016-02-13 CRAN (R 3.3.0)                       
 nlme         3.1-131    2017-02-06 CRAN (R 3.3.2)                       
 parallel     3.3.2      2016-10-31 local                                
 pkgconfig    2.0.1      2017-03-21 cran (@2.0.1)                        
 plyr         1.8.4      2016-06-08 CRAN (R 3.3.0)                       
 psych        1.7.3.21   2017-03-22 cran (@1.7.3.2)                      
 purrr        0.2.4      2017-10-18 cran (@0.2.4)                        
 R6           2.2.2      2017-06-17 cran (@2.2.2)                        
 Rcpp         0.12.14    2017-11-23 cran (@0.12.14)                      
 reshape2     1.4.3      2017-12-11 cran (@1.4.3)                        
 rlang        0.2.0.9001 2018-06-30 Github (tidyverse/rlang@ba4fb06)     
 scales       0.5.0.9000 2018-06-17 Github (hadley/scales@4056ec3)       
 splines      3.3.2      2016-10-31 local                                
 stats      * 3.3.2      2016-10-31 local                                
 stringi      1.1.6      2017-11-17 cran (@1.1.6)                        
 stringr      1.3.0      2018-02-19 cran (@1.3.0)                        
 survival   * 2.41-3     2017-04-04 CRAN (R 3.3.2)                       
 survminer  * 0.3.1.999  2017-06-05 Github (kassambara/survminer@8511dee)
 survMisc     0.5.4      2016-11-23 CRAN (R 3.3.2)                       
 tibble       1.3.4      2017-08-22 cran (@1.3.4)                        
 tidyr        0.8.1.9000 2018-06-30 Github (tidyverse/tidyr@cbdd14e)     
 tools        3.3.2      2016-10-31 local                                
 utils      * 3.3.2      2016-10-31 local                                
 withr        2.1.2      2018-06-30 Github (jimhester/withr@fe56f20)     
 xtable       1.8-2      2016-02-05 CRAN (R 3.3.0)                       
 yaml         2.1.16     2017-12-12 cran (@2.1.16)                       
 zoo          1.7-14     2016-12-16 CRAN (R 3.3.2)   

@grvsinghal
Copy link
Author

Thanks for quick response, I earlier asked a resolution of this issue on stack overflow (here). I have asked the person who replied, to confirm whether he was able to reproduce the issue.

@kassambara
Copy link
Owner

I made a minor change in ggforest function. Does it fix this issue?

@grvsinghal
Copy link
Author

grvsinghal commented Jul 10, 2018

Thanks, now it shows the output, however, before actual graph, it creates an empty chart.
I have got a workaround by assigning a name to the plot and then calling that name in next chunk. Issue of blank chart or non-plotting or double-plotting never occurred when I plot it in the next chunk.

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

2 participants