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

The Kaplan-Meier plot is truncated #309

Open
olkap opened this issue May 17, 2018 · 0 comments
Open

The Kaplan-Meier plot is truncated #309

olkap opened this issue May 17, 2018 · 0 comments

Comments

@olkap
Copy link

olkap commented May 17, 2018

Expected behavior

The whole Kaplan-Meier plot is visible, when ggsurvplot is used.

Actual behavior

The Kaplan-Meier plot is sometimes truncated on the right side. The example is the Kaplan-Meier plot for data from colon library. When we use default values of arguments in ggsurvplot, the last days are truncated. It looks ok, when the xlim value is manually set.

Steps to reproduce the problem

library(survival)
library(survminer)
data(colon)

#Kaplan-Meier with default parameter values
fit <- survfit(Surv(time,status) ~ 1, data=colon)
ggsurvplot(fit, data = colon, ggtheme = theme_bw())
km - days wrong

#When we extend the xlim, it looks ok:
ggsurvplot(fit, data = colon, ggtheme = theme_bw(), xlim = range(colon$time))
km - days ok

Please note that the last days in both images looks different (last days are missing on the first plot)

session_info()

Session info --------------------------------------------------------------------------------------------------
 setting  value                       
 version  R version 3.4.1 (2017-06-30)
 system   x86_64, mingw32             
 ui       RStudio (1.0.143)           
 language (EN)                        
 collate  English_United Kingdom.1252 
 tz       Europe/Warsaw               
 date     2018-05-17                  

Packages ------------------------------------------------------------------------------------------------------
 package    * version date       source        
 assertthat   0.2.0   2017-04-11 CRAN (R 3.4.2)
 base       * 3.4.1   2017-06-30 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.4   2018-03-29 CRAN (R 3.4.4)
 cmprsk       2.2-7   2014-06-17 CRAN (R 3.4.3)
 colorspace   1.3-2   2016-12-14 CRAN (R 3.4.2)
 compiler     3.4.1   2017-06-30 local         
 data.table   1.11.2  2018-05-08 CRAN (R 3.4.4)
 datasets   * 3.4.1   2017-06-30 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.4   2017-09-28 CRAN (R 3.4.2)
 foreign      0.8-70  2018-04-23 CRAN (R 3.4.4)
 ggplot2    * 2.2.1   2016-12-30 CRAN (R 3.4.2)
 ggpubr     * 0.1.6   2017-11-14 CRAN (R 3.4.4)
 glue         1.2.0   2017-10-29 CRAN (R 3.4.2)
 graphics   * 3.4.1   2017-06-30 local         
 grDevices  * 3.4.1   2017-06-30 local         
 grid         3.4.1   2017-06-30 local         
 gridExtra    2.3     2017-09-09 CRAN (R 3.4.2)
 gtable       0.2.0   2016-02-26 CRAN (R 3.4.2)
 km.ci        0.5-2   2009-08-30 CRAN (R 3.4.3)
 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.1)
 lazyeval     0.2.1   2017-10-29 CRAN (R 3.4.4)
 magrittr   * 1.5     2014-11-22 CRAN (R 3.4.2)
 Matrix       1.2-14  2018-04-09 CRAN (R 3.4.4)
 memoise      1.1.0   2017-04-21 CRAN (R 3.4.1)
 methods    * 3.4.1   2017-06-30 local         
 mnormt       1.5-5   2016-10-15 CRAN (R 3.4.1)
 munsell      0.4.3   2016-02-13 CRAN (R 3.4.2)
 nlme         3.1-137 2018-04-07 CRAN (R 3.4.4)
 parallel     3.4.1   2017-06-30 local         
 pillar       1.2.2   2018-04-26 CRAN (R 3.4.4)
 pkgconfig    2.0.1   2017-03-21 CRAN (R 3.4.1)
 plyr         1.8.4   2016-06-08 CRAN (R 3.4.2)
 psych        1.8.4   2018-05-06 CRAN (R 3.4.4)
 purrr        0.2.4   2017-10-18 CRAN (R 3.4.3)
 R6           2.2.2   2017-06-17 CRAN (R 3.4.1)
 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.0   2018-02-20 CRAN (R 3.4.4)
 scales       0.5.0   2017-08-24 CRAN (R 3.4.2)
 splines      3.4.1   2017-06-30 local         
 stats      * 3.4.1   2017-06-30 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.42-3  2018-04-16 CRAN (R 3.4.4)
 survminer  * 0.4.2   2018-01-31 CRAN (R 3.4.3)
 survMisc     0.5.4   2016-11-23 CRAN (R 3.4.3)
 tibble       1.4.2   2018-01-22 CRAN (R 3.4.3)
 tidyr        0.8.0   2018-01-29 CRAN (R 3.4.3)
 tools        3.4.1   2017-06-30 local         
 utils      * 3.4.1   2017-06-30 local         
 withr        2.1.2   2018-03-15 CRAN (R 3.4.4)
 xtable       1.8-2   2016-02-05 CRAN (R 3.4.2)
 zoo          1.8-1   2018-01-08 CRAN (R 3.4.4)
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