powered by
Generates a Kaplan-Meier survival curve plot using ggsurvfit::ggsurvfit() with customizable options. This function provides sensible defaults while allowing for customization.
ggsurvfit::ggsurvfit()
plot_km( fit, risktable = TRUE, risktable_symbols = TRUE, median_line = TRUE, legend_position = "top", plot_theme = theme_easysurv(), risktable_theme = theme_risktable_easysurv() )
A ggplot object representing the Kaplan-Meier survival curve plot.
A survival::survfit object representing the survival data.
Logical value indicating whether to include a risk table below the plot. Default is TRUE.
TRUE
Logical value indicating whether to include symbols instead of text to label risk table strata. Default is TRUE.
Logical value indicating whether to include a line representing the median survival time. Default is TRUE.
Position of the legend in the plot. Default is "top".
ggplot2 theme for the plot. Default is theme_easysurv().
theme_easysurv()
ggplot2 theme for the risk table. Default is theme_risktable_easysurv().
theme_risktable_easysurv()
library(ggsurvfit) fit <- survfit2(Surv(time, status) ~ surg, data = df_colon) plot_km(fit, risktable_symbols = FALSE)
Run the code above in your browser using DataLab