This work is licensed under Creative Commons Zero v1.0 Universal.
Daniel D. Sjoberg
Mark Baillie
Motivation and why {ggsurvfit} ?
Overview of package functionality
Additional examples
Time-to-event (a.k.a Survival or Kaplan-Meier) summaries are commonplace, from oncology to cardiovascular.
KM displays the estimated cumulative proportion over time of patients who survive (or report an event)
However, it was not such a simple start:
John Tukey insisted Edward L. Kaplan and Paul Meier combine their efforts after submitting independent papers to JASA, which took 4 more years for the authors of the “KM” estimator to publish
Afterwards “Paul Meier himself is said to have spoken with bemusement about people plotting KM estimates over time and was not convinced he actually liked it” Morris et al, 2018
There are many design and analytical choices to be made when designing even a simple KM plot – these choices can lead to wide variation in presentation quality.
Ease the creation of time-to-event summary figures with ggplot2
Concise and modular code
Ready for publication or sharing figures
Sensible defaults
Supports CDISC data model
Also supports competing risks cumulative incidence summaries
ggsurvfit
add-on function is written as a proper ggplot2
geomggsurvfit
functionsLimitless customization
Simple saving and export through ggplot2::ggsave()
time
column label+
notationPadding has been reduced and curves begin in the upper left corner of plot
x-axis reports additional time points (and as a result, the risk table as well)
We updated the y-axis label weaving standard ggplot2 functions
Padding has been reduced and curves begin in the upper left corner of plot
x-axis reports additional time points (and as a result, the risk table as well)
We updated the y-axis label weaving standard ggplot2 functions
We can even use ggplot2-extender functions
gg_styled <-
gg_default +
coord_cartesian(xlim = c(0, 8)) +
scale_y_continuous(
limits = c(0, 1),
labels = scales::percent,
expand = c(0.01, 0)
) +
scale_x_continuous(breaks = 0:9, expand = c(0.02, 0)) +
scale_color_manual(values = c('#54738E', '#82AC7C')) +
scale_fill_manual(values = c('#54738E', '#82AC7C')) +
theme_minimal() +
theme(legend.position = "bottom") +
guides(color = guide_legend(ncol = 1)) +
labs(
title = "{ggplot2} styled",
y = "Percentage Survival"
)
gg_styled
There are many options to consider and many guidances available:
Morris et al. 2018 provide useful guidance for publication figures
To get figures that align with KMunicate use the theme_ggsurvfit_KMunicate()
theme along with these function options.
A note of caution on standards:
Design for your purpose, one size does not fit all
Designing means you need to think carefully about your audience and aims
survfit2(Surv(time, status) ~ surg, data = df_colon) |>
ggsurvfit(linetype_aes = TRUE) +
add_confidence_interval() +
add_risktable(
risktable_stats = c("n.risk", "cum.censor", "cum.event")
) +
theme_ggsurvfit_KMunicate() +
scale_ggsurvfit() +
theme(legend.position = c(0.85, 0.85)) +
labs(y = "Recurrence-free Progression")
Ease the creation of time-to-event summary figures with ggplot2
Concise and modular code
Ready for publication or sharing figures
Sensible defaults
Also supports competing risks cumulative incidence summaries