# SCI Figure Hub — Kaplan-Meier Survival Step Curve (CC0-1.0) library(ggplot2) pal <- c("#E64B35", "#3C5488") t <- c(0, 6, 12, 18, 24, 30, 36, 48, 60) df <- data.frame( time = rep(t, 2), group = factor(rep(c("Treatment", "Control"), each = length(t)), levels = c("Treatment", "Control")), surv = c(1.00, 0.94, 0.87, 0.82, 0.76, 0.72, 0.68, 0.63, 0.60, 1.00, 0.86, 0.71, 0.58, 0.46, 0.39, 0.33, 0.27, 0.22), lo = c(1.00, 0.89, 0.81, 0.75, 0.69, 0.65, 0.61, 0.56, 0.52, 1.00, 0.79, 0.64, 0.50, 0.38, 0.31, 0.25, 0.19, 0.15), hi = c(1.00, 0.99, 0.93, 0.89, 0.83, 0.79, 0.75, 0.70, 0.68, 1.00, 0.93, 0.78, 0.66, 0.54, 0.47, 0.41, 0.35, 0.29) ) p <- ggplot(df, aes(x = time, y = surv, colour = group, fill = group)) + geom_ribbon(aes(ymin = lo, ymax = hi), alpha = 0.14, colour = NA, stat = "identity") + geom_step(linewidth = 0.85) + annotate("text", x = 3, y = 0.14, hjust = 0, size = 2.6, label = "Log-rank p = 0.0014\nHR = 0.48 (0.31–0.74)") + scale_colour_manual(values = pal, name = NULL) + scale_fill_manual(values = pal, name = NULL) + scale_y_continuous(limits = c(0, 1.04)) + labs(x = "Follow-up Time (months)", y = "Survival Probability") + theme_classic(base_size = 8) + theme(legend.position = "top") ggsave("kaplan_meier.pdf", p, width = 89, height = 68, units = "mm")