From c0c890c78c834cb0c1b122fda33a6de0491bf71e Mon Sep 17 00:00:00 2001 From: Jens Sauer Date: Tue, 17 Nov 2020 13:28:06 +0100 Subject: [PATCH] survival: Improve plots Display a risk table, median survival line and adjust theme. --- survival.R | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/survival.R b/survival.R index 9b165a8..49535fc 100644 --- a/survival.R +++ b/survival.R @@ -17,7 +17,10 @@ surv_asct <- Surv(time = secmal$event_time_asct, event = secmal$event_status) sma_plot_surv_dx <- function() { ggsurvplot(survfit(surv_dx ~ 1), data = secmal, xscale = "d_y", title = "Survival after diagnosis", - break.time.by = 5 * 365.25) + break.time.by = 5 * 365.25, + surv.median.line = "hv", + risk.table = "abs_pct", + ggtheme = theme_bw()) } # plot survival after diagnosis per sex @@ -26,6 +29,9 @@ sma_plot_surv_dx_sex <- function() { xscale = "d_y", title = "Survival after diagnosis", legend.labs = c("Female", "Male"), break.time.by = 5 * 365.25, + surv.median.line = "hv", + risk.table = "abs_pct", + ggtheme = theme_bw(), pval = TRUE) } @@ -33,7 +39,10 @@ sma_plot_surv_dx_sex <- function() { sma_plot_surv_asct <- function() { ggsurvplot(survfit(surv_asct ~ 1), data = secmal, xscale = "d_y", title = "Survival after transplantation", - break.time.by = 5 * 365.25) + break.time.by = 5 * 365.25, + surv.median.line = "hv", + risk.table = "abs_pct", + ggtheme = theme_bw()) } # plot survival after transplantation per sex @@ -42,6 +51,9 @@ sma_plot_surv_asct_sex <- function() { xscale = "d_y", title = "Survival after transplantation", legend.labs = c("Female", "Male"), break.time.by = 5 * 365.25, + surv.median.line = "hv", + risk.table = "abs_pct", + ggtheme = theme_bw(), pval = TRUE) }