# Default publication ready plot
survfit2(Surv(time, status) ~ sex, data = df_lung) %>%
ggsurvfit() +
scale_ggsurvfit(x_scales = list(breaks = seq(0, 30, by = 6)))
# Changing statistic type
survfit2(Surv(time, status) ~ sex, data = df_lung) %>%
ggsurvfit(type = "cumhaz")
# Configuring KM line type to vary by strata
survfit2(Surv(time, status) ~ sex, data = df_lung) %>%
ggsurvfit(linetype_aes = TRUE) +
scale_ggsurvfit()
# Customizing the plot to your needs
survfit2(Surv(time, status) ~ 1, data = df_lung) %>%
ggsurvfit() +
add_censor_mark() +
add_confidence_interval() +
add_quantile() +
add_risktable() +
scale_ggsurvfit()
Run the code above in your browser using DataLab