Closed kassambara closed 7 years ago
Backward compatibility will be preserved with upcoming changes
Creating the ggrisktable()
helper function to make ggsurvplot()
cleaner. Normally, users don't need to use this function directly. Internally used by the ggsurvplot
() function
New function ggrisktable()
added
# Fit survival curves
library(survival)
fit2 <- survfit( Surv(time, status) ~ rx + adhere,
data = colon )
# Plotting the survival curves
library(survminer)
ggrisktable(fit2, data = colon, color = "strata", palette = "jco")
Now, the output of ggsurvplot()
can look like this:
library(survival)
fit <- survfit( Surv(time, status) ~ sex,
data = lung )
library(survminer)
ggsurvplot(fit, data = lung,
risk.table = TRUE,
risk.table.title = "No at Risk",
cumevents = TRUE,
cumevents.title = "Cumulative No of Events",
ncensor.plot = TRUE,
ncensor.plot.title = "No of Censored Subjects",
palette = "jco",
risk.table.height = 0.2,
cumevents.height = 0.2,
ncensor.plot.height = 0.2
)
The ncensor plot, based on raw timing, is not easy to read. This can be even more difficult in the situation, where the number of strata >= 3. To resolve this problem, @pbiecek implement a very convenient solution in ggsurvevents()
.
One could also display the cumulative number of censored subjects as a table.
Now, it's possible to display the cumulative number of censoring. Examples are provided at https://github.com/kassambara/survminer/issues/155
Symplifying test name in .get_pvalue()
method <- "Log-rank (survdiff)"
test_name <- c("Log-rank (comp)", "Gehan-Breslow (generalized Wilcoxon)",
"Tarone-Ware", "Peto-Peto's modified survival estimate",
"modified Peto-Peto (by Andersen)", "Fleming-Harrington (p=1, q=1)")
Suggestion:
method <- "Log-rank"
test_name <- c("Log-rank", "Gehan-Breslow",
"Tarone-Ware", "Peto-Peto",
"modified Peto-Peto", "Fleming-Harrington (p=1, q=1)")
Now
ggsurvplot()
returns list, which can contain four components:Adding extra arguments in
ggsurvplot()
, to change the graphical parameters - title, subtitle, caption and font - of each of these components, will make the ggsurvplot() doc hard to read.For any hyper-customization of ggsurvplot components, users should use either the function
ggplot2::labs()
or the functionggpubr::ggpar()
as demontrated in the README file.the function
ggpar()
provides, with less typing, a convenient way to play with fonts and palettes (custom color, RColorBrewer and ggsci color palettes)