kassambara / survminer

Survival Analysis and Visualization
https://rpkgs.datanovia.com/survminer/
495 stars 160 forks source link

ggcoxzph with tranform='log' #588

Open cincy22 opened 2 years ago

cincy22 commented 2 years ago

Expected behavior

The created Schoenfeld residual plot should display the x-axis data correctly when transform='log' is used.

Actual behavior

The x-axis data in the Schoenfeld residual plot are squeezed to a narrow range when transform='log' is used. ggcoxzph_log

Steps to reproduce the problem

fit <- coxph(Surv(futime, fustat) ~ age + ecog.ps + rx, data=ovarian) cox.zph.fit.log <- cox.zph(fit, transform='log') ggcoxzph(cox.zph.fit.log)

session_info()

R version 4.0.3 (2020-10-10) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 18363)

Matrix products: default

locale: [1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
system code page: 936

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

other attached packages: [1] survminer_0.4.9 ggpubr_0.4.0 ggplot2_3.3.5 survival_3.2-13

loaded via a namespace (and not attached): [1] pillar_1.6.4 compiler_4.0.3 tools_4.0.3 digest_0.6.29
[5] lifecycle_1.0.1 tibble_3.1.6 gtable_0.3.0 lattice_0.20-45
[9] pkgconfig_2.0.3 rlang_0.4.12 Matrix_1.4-0 DBI_1.1.2
[13] yaml_2.2.1 xfun_0.29 gridExtra_2.3 knitr_1.37
[17] withr_2.4.3 dplyr_1.0.7 survMisc_0.5.5 generics_0.1.1
[21] vctrs_0.3.8 grid_4.0.3 tidyselect_1.1.1 data.table_1.14.2 [25] glue_1.6.0 KMsurv_0.1-5 R6_2.5.1 rstatix_0.7.0
[29] km.ci_0.5-2 fansi_0.5.0 carData_3.0-4 farver_2.1.0
[33] purrr_0.3.4 tidyr_1.1.4 car_3.0-12 magrittr_2.0.1
[37] scales_1.1.1 backports_1.4.1 ellipsis_0.3.2 splines_4.0.3
[41] abind_1.4-5 assertthat_0.2.1 xtable_1.8-4 colorspace_2.0-2 [45] ggsignif_0.6.3 labeling_0.4.2 utf8_1.2.2 tinytex_0.36
[49] munsell_0.5.0 broom_0.7.10 crayon_1.4.2 zoo_1.8-9

MarcinKosinski commented 2 years ago

Hey @cincy22. Is it a duplicate of https://github.com/kassambara/survminer/issues/454?