What survival data you need, how censoring works, which test to use, and how to plot a publication-ready curve.
Kaplan-Meier curves are the standard way to visualize time-to-event data — survival, relapse, time-to-failure. They look simple but have specific requirements around censoring and the right statistical test. Here's how to make one correctly.
What a Kaplan-Meier curve shows
A Kaplan-Meier curve plots the probability that subjects "survive" (haven't yet experienced the event) over time. It's a descending step function: each step down marks an event (e.g. a death or relapse). Multiple groups (e.g. treatment vs control) are plotted as separate curves to compare survival.
The data you need
For each subject, you need:
- Time — how long until the event, or until they were last observed.
- Event status — did the event happen (1) or not (0)? A "0" means the subject was censored — they left the study or it ended before their event occurred.
- Group (optional) — which arm they belong to, if comparing groups.
A minimal layout:
Time, Event, Group
5, 1, Control
8, 0, Control
12, 1, Treated
Censoring — the key concept
Censoring is what makes survival analysis different from a normal plot. A censored subject (event = 0) didn't experience the event during observation — maybe the study ended, or they dropped out. They still contribute information (they survived up to their last observation), so they aren't discarded. On the curve, censored points are usually marked with small tick marks. Handling censoring correctly is essential — treating censored subjects as events would bias the result.
The right statistical test: log-rank
To compare survival between groups, the standard test is the log-rank test — not a t-test or ANOVA. The log-rank test compares the entire survival curves across groups. (A common mistake is applying a means-based test to survival data — see our guide to choosing the right statistical test for why this matters.)
Step-by-step
- Organize your data: time, event status (1/0), and group for each subject.
- Compute the survival function for each group (Kaplan-Meier estimator).
- Plot the step curves — descending steps, one per group, with censoring tick marks.
- Run the log-rank test to compare groups and report the p-value.
- Optionally add a risk table below the plot showing subjects at risk over time.
- Export at journal resolution.
Common mistakes
- Ignoring or mishandling censoring — censored subjects must be included correctly, not dropped or treated as events.
- Using the wrong test — survival comparisons use the log-rank test, not t-test or ANOVA.
- Smoothing the curve — Kaplan-Meier is a step function; don't draw it as a smooth line.
- Omitting censoring marks — readers expect to see where censoring occurred.
Doing it more easily
You can compute Kaplan-Meier curves in R (survival package), Python (lifelines), or dedicated software. FigureGuild's Graph Builder also produces Kaplan-Meier curves from time/event/group data — proper descending step function, censoring marks, and the log-rank test — exported at publication resolution.
Try it free at figureguild.com.
Final thought
A correct Kaplan-Meier curve comes down to three things: handle censoring properly, draw it as a step function with censoring marks, and compare groups with the log-rank test. Get those right and you have a publication-ready survival analysis.
FigureGuild builds Kaplan-Meier curves and other publication-grade figures from your data. Free to try.