Tutorials › Biostatistics › Kaplan-Meier Plot Best Practices

Survival Analysis

Kaplan-Meier Plot Best Practices

A practical guide to designing, interpreting, and programming publication-quality Kaplan-Meier plots for clinical trials, including censoring, numbers at risk, confidence intervals, median survival, time scales, subgroup displays, and common reporting mistakes.

Intermediate24 min read

What You'll Learn

  • What a Kaplan-Meier curve actually estimates
  • How censoring and the risk set affect the curve
  • How to display confidence intervals and numbers at risk
  • How to report median survival and landmark survival estimates
  • How to choose time scales, axes, ticks, and truncation responsibly
  • How to build clean KM plots in R using survival and survminer

Introduction

A Kaplan-Meier (KM) plot is one of the most recognizable figures in clinical-trial reporting. It is used to display the estimated probability of remaining event-free over time when the outcome is time-to-event and some patients have not experienced the event by the time of analysis.

The apparent simplicity of the figure can be misleading. A good KM plot is not merely a survival curve with two colored lines. The figure should make the estimand, event definition, censoring convention, population, follow-up time, uncertainty, and treatment comparison understandable without forcing the reader to reconstruct the analysis from the methods section.

Key idea: The Kaplan-Meier estimator describes the estimated survival function, S(t): the probability of remaining free of the event of interest beyond time t. The plot is descriptive; the statistical comparison is usually supplied separately through a prespecified model or test such as a stratified log-rank test and/or Cox model.

What Is a Kaplan-Meier Plot?

The Kaplan-Meier estimator is a product-limit estimator. At each distinct event time, the estimated probability of surviving beyond that time is updated according to the number of events and the number of patients at risk immediately before the event.

Ŝ(t) = ∏tj ≤ t (1 − dj / nj)

where nj is the number at risk just before event time tj, and dj is the number of events at that time.

The curve therefore changes at event times. A patient who is censored does not create a downward step; instead, that patient leaves the risk set for subsequent event times.

The Basic Anatomy of a Good KM Figure

ComponentBest-practice role
X-axisClearly defined time scale and clinically meaningful units.
Y-axisEstimated survival probability, usually shown from 0 to 1 or 0% to 100%.
CurveOne step function per treatment group or analysis group.
Censoring marksShow where observations were censored without implying an event.
Confidence intervalCommunicate statistical uncertainty around the estimated curve when appropriate.
Numbers at riskShow how much information remains at clinically relevant time points.
LegendIdentify groups using the same labels as the analysis and tables.
Event/analysis informationClarify event definition, analysis population, and follow-up convention in the caption or footnote.

An Actual Kaplan-Meier Plot

The following simulated example shows the essential components of a two-arm time-to-event display. The curves are illustrative rather than clinical-trial data.

Figure 1. Kaplan-Meier Estimate With Confidence Intervals and Censoring
Illustrative event-free survival for two treatment groups. Censoring marks indicate patients who were still event-free when follow-up ended or who otherwise left observation under the analysis convention.
Treatment A
Treatment B
50% survival reference

The curves are simulated. Confidence bands are included to illustrate uncertainty; they are not intended to represent a particular trial's estimates.

Step 1: Define the Time-to-Event Endpoint Before Plotting

The most important KM best practice occurs before any graphics are created: define exactly what counts as an event and what time origin is being used.

Examples include:

  • Overall survival: time from a prespecified origin to death from any cause.
  • Progression-free survival: time from the prespecified origin to progression or death, according to the protocol-defined endpoint.
  • Time to treatment failure: time from the origin to the first qualifying treatment-failure event.
  • Time to a specific safety event: time from the relevant origin to the first occurrence of the specified event.
Best practice: Never label a curve simply “Survival” when the endpoint is actually progression-free survival, event-free survival, disease-free survival, or another composite endpoint. The figure title, axis/legend, and accompanying text should use the prespecified endpoint terminology.

Step 2: Define the Time Origin

The x-axis is only interpretable when the time origin is known. Depending on the protocol, time zero may be randomization, first dose, surgery, diagnosis, or another prespecified milestone.

Time originExample useKey reporting point
RandomizationMany randomized efficacy endpointsSupports an intention-to-treat treatment comparison when specified.
First doseSome treatment-exposure analysesState that time is measured from first dose.
SurgeryPost-operative recurrence endpointsMake the surgical time point explicit.
DiagnosisDisease-course studiesBe precise about diagnostic definition and date.

Changing the time origin can change the analysis population, risk sets, and interpretation. It should therefore be an analysis decision, not a cosmetic plotting choice.

Step 3: Understand Censoring

Right censoring occurs when the event of interest has not been observed by the end of a patient's observed follow-up, or when the patient otherwise leaves observation according to the prespecified censoring rules.

For a conventional right-censored KM analysis, censoring generally means that the patient contributes information up to the censoring time and then leaves the risk set. It does not mean that the patient experienced the event.

1
Start: patient enters the risk set at the defined time origin.
2
Event: patient experiences the endpoint and contributes an event at that time.
3
Censoring: patient leaves the risk set without an observed event under the censoring convention.
4
Estimator: future event probabilities are calculated using the patients still at risk.

Censoring marks are useful because they remind the reader that the flat portion of a curve does not necessarily mean every patient remained under observation.

Do Not Hide Censoring Marks

A common aesthetic mistake is to remove censoring marks because they make a figure look “busy.” This can make the tail of a curve appear more certain than it really is.

Censoring marks are especially important late in follow-up, when only a small number of patients may remain under observation. If the figure uses a confidence band and a numbers-at-risk table, the censoring marks can remain subtle, but they should generally remain identifiable.

Step 4: Show Numbers at Risk

The numbers-at-risk table is one of the most useful additions to a KM figure. It tells the reader how many patients remain in the risk set at selected time points.

Figure 2. Kaplan-Meier Plot With Numbers at Risk
The risk table makes the amount of information supporting the curve visible at each selected time point.

In a real report, risk-table values should come directly from the analysis dataset and use the same population and censoring convention as the plotted curves.

Risk-table intervals should be chosen to balance readability and information. Common choices include monthly, quarterly, or clinically meaningful landmark times, depending on the follow-up duration.

Why the Tail of the Curve Needs Caution

A KM curve can continue far to the right even when very few patients remain at risk. A visually smooth tail does not mean that the estimate is based on a large amount of information.

For example, suppose a study begins with 400 patients but only 12 remain at risk near the end of follow-up. A small number of events or censoring times can materially change the estimated curve. The risk table makes this limitation immediately visible.

Best practice: Do not interpret the far-right tail of a KM curve in isolation. Always consider the number at risk, the number of events, the amount of censoring, and the confidence interval.

Step 5: Add Confidence Intervals When They Improve Interpretation

A KM estimate is uncertain. Confidence intervals can communicate that uncertainty directly on the figure.

For a publication or clinical study report, the decision to show confidence bands should be consistent with the statistical reporting strategy. If bands are shown, the figure legend or footnote should identify the confidence level and the method if required by the reporting standard.

Confidence intervals should not be mistaken for prediction intervals, and they should not be used as a visual substitute for a prespecified hypothesis test.

Median Survival: Useful, but Not Always Available

The median survival time is the time at which the estimated survival probability reaches 0.50. If the curve never falls to 0.50 during the observed analysis period, the median is not estimable from that analysis.

Median survival = inf { t : Ŝ(t) ≤ 0.50 }

This leads to an important reporting distinction:

SituationAppropriate interpretation
Curve crosses 50%Median can be estimated, subject to the analysis method and confidence interval.
Curve remains above 50%Median is not reached / not estimable during the analysis.
Very sparse tailMedian may be statistically unstable; report the confidence interval and event information.
Do not write “median = X months” merely because X is the last observed time. The median is determined by the estimated survival function, not by the maximum follow-up time.

Landmark Survival Estimates

Sometimes a fixed-time survival estimate is more informative than the median. Examples include survival at 6, 12, 24, or 36 months, depending on the disease and endpoint.

A good KM figure can complement the curve with a table or text reporting the estimated survival probability and confidence interval at prespecified landmarks.

Figure 3. Landmark Interpretation
The vertical guide illustrates how a fixed-time survival estimate can be read from the KM curve.

The landmark line is illustrative. A production figure should use prespecified landmark times and report the corresponding estimates and confidence intervals.

Step 6: Choose the X-Axis Carefully

The x-axis should use units that match the clinical context. Days may be appropriate for short follow-up, whereas months or years may be easier to interpret for long-term survival.

Avoid unnecessary decimal precision. If follow-up is conventionally reported in months, labels such as 3, 6, 9, 12, 18, and 24 months are usually easier to read than a dense sequence of highly precise values.

At the same time, the underlying analysis should retain the appropriate event and censoring times. Simplifying the displayed tick labels must not imply that the statistical analysis was performed only at those landmarks.

Step 7: Use a Sensible Y-Axis

The y-axis is usually survival probability, expressed either from 0 to 1 or from 0% to 100%. Percentage labels are often intuitive for clinical audiences.

Unless there is a compelling reason to do otherwise, avoid an overly compressed y-axis that visually exaggerates small absolute differences. A truncated y-axis can make two curves appear dramatically separated when their absolute difference is modest.

Best practice: The visual scale should make the clinical magnitude of the difference easy to judge. If the y-axis is deliberately restricted, explain the choice and verify that it does not materially distort interpretation.

Step 8: Keep Treatment Groups Visually Consistent

Treatment labels and visual encodings should remain consistent across the KM figure, efficacy tables, subgroup figures, and text. If “Placebo” is used in the tables, do not call the same group “Control” in the figure unless that distinction is intentional.

Color can distinguish treatment groups, but the figure should remain understandable when printed in grayscale or viewed by readers with color-vision deficiencies. Line style, labels, and ordering can provide additional redundancy.

When to Use Separate Panels

Separate panels can be useful when the figure contains many strata or when a single combined plot becomes difficult to read. Examples include panels by endpoint, disease cohort, or prespecified population.

When treatment groups are compared across panels, keep the scales and treatment ordering consistent unless there is a documented reason not to.

Subgroup KM Plots

Subgroup KM figures require additional caution. A visually different curve in a small subgroup is not evidence of a treatment effect in that subgroup unless the analysis was prespecified and appropriately estimated.

  • State the subgroup definition clearly.
  • Show the subgroup sample size.
  • Be aware of sparse event counts.
  • Use consistent time and probability scales across comparable panels.
  • Do not infer interaction from separate within-subgroup p-values.
Key principle: A KM plot can display subgroup survival, but it does not by itself establish treatment-by-subgroup interaction.

Step 9: Distinguish the Curve From the Statistical Comparison

Two curves can appear separated without the corresponding statistical comparison being significant, and curves can cross in ways that make a single hazard-ratio summary difficult to interpret.

The figure should therefore be treated as one part of the evidence package. Depending on the estimand and analysis plan, the associated report may include:

  • Number of patients analyzed
  • Number and percentage with events
  • Median time-to-event and confidence interval, when estimable
  • Landmark survival estimates, when prespecified
  • Hazard ratio and confidence interval, when appropriate
  • Prespecified hypothesis-test results

Crossing Curves

Crossing KM curves deserve special attention. The proportional-hazards assumption may be questionable when the treatment effect changes substantially over time, and a single hazard ratio may not summarize the treatment contrast adequately.

A KM figure can reveal the crossing pattern, but the figure does not determine which alternative analysis should be used. The appropriate approach depends on the estimand, trial design, timing of effects, censoring, and statistical analysis plan.

Figure 4. Crossing Survival Curves
Illustrative example showing why a single visual separation or a single hazard-ratio interpretation may be inadequate when effects vary over time.

This example is conceptual and simulated. It demonstrates a visual pattern rather than prescribing a particular inferential method.

Competing Risks: Do Not Automatically Use a Standard KM Curve

When the event of interest can be precluded by a different event that prevents its occurrence, competing risks need to be considered. A conventional KM estimate treating competing events as ordinary censoring answers a different question from the cumulative incidence of the event in the presence of competing risks.

For example, if the endpoint is time to a specific cause of death, deaths from other causes are not necessarily equivalent to ordinary non-informative censoring for the clinical question of interest.

Best practice: Confirm that the estimand matches the estimator. If the scientific question is cumulative incidence in the presence of competing risks, use an analysis and graphical display appropriate to competing risks rather than assuming a standard KM curve is sufficient.

Delayed Entry and Left Truncation

Some studies have patients enter the risk set after the nominal start of the time scale. This is often called delayed entry or left truncation. The risk-set construction must account for the time at which each patient becomes observable and eligible for the analysis.

A simple KM plot generated without accounting for delayed entry can therefore be wrong even if the final figure looks polished.

Immortal Time and Time-Dependent Definitions

Another common source of bias occurs when exposure or treatment classification depends on information that becomes available after time zero. If a patient must survive long enough to be classified into a group, a naive KM comparison can introduce immortal-time bias.

The figure cannot fix an incorrectly defined analysis population. Treatment assignment, landmarking, time-dependent covariates, and other design choices must be handled in the analysis dataset before the plot is generated.

Do Not Smooth Kaplan-Meier Curves

A KM estimator is a step function. Smoothing it can obscure the actual estimator and make event timing less transparent.

If a smoothed survival or hazard display is desired for an exploratory purpose, it should be presented as a different analysis rather than as a cosmetically modified KM estimate.

Numbers at Risk vs. Patients Still Under Follow-Up

The number at risk is not simply “the number of patients still in the study.” It is the number contributing to the risk set under the specific survival analysis at that time.

Patients can leave the risk set because of an event or censoring. Consequently, the risk-table value should be interpreted in the context of the endpoint and censoring rules.

Example Interpretation

Suppose the treatment-A curve is 0.82 at 12 months and the treatment-B curve is 0.70. A careful interpretation is that the estimated event-free survival probability at 12 months is approximately 82% for treatment A and 70% for treatment B, under the analysis population and censoring rules used.

It would be inappropriate to conclude from those two percentages alone that treatment A “reduces risk by 12%.” The absolute survival difference is 12 percentage points; relative risk, hazard ratio, and other effect measures answer different questions.

Absolute Difference vs. Relative Effect

MeasureWhat it describes
Survival probabilityEstimated probability of remaining event-free at a specified time.
Absolute differenceDifference in survival probabilities between groups at a specified time.
Hazard ratioRelative instantaneous event rate under the model assumptions and estimand.
Median survivalTime at which the estimated survival probability reaches 50%, if reached.

Data Structure for a KM Plot

A minimal patient-level survival-analysis dataset generally contains an identifier, a time variable, an event indicator, and the grouping variable. Additional variables may define strata, analysis populations, or other prespecified factors.

VariableDescription
USUBJIDUnique participant identifier
AVALAnalysis time to event or censoring
EVENTEvent indicator, typically 1 for event and 0 for censored observation under the coding convention
TRT01PPlanned treatment group or equivalent analysis grouping variable
STRATUMOptional stratification variable when applicable
Validation rule: Every curve, censoring mark, risk-table value, and summary statistic should be traceable back to the same defined analysis population and endpoint derivation.

R Implementation

The survival package provides the core Kaplan-Meier estimator. The example below creates a standard two-group KM plot.

library(survival)
library(survminer)

fit <- survfit(
  Surv(AVAL, EVENT) ~ TRT01P,
  data = analysis
)

ggsurvplot(
  fit,
  data = analysis,
  conf.int = TRUE,
  censor = TRUE,
  risk.table = TRUE,
  risk.table.height = 0.24,
  xlab = "Time from Randomization (months)",
  ylab = "Event-Free Survival Probability",
  break.time.by = 3,
  surv.scale = "percent",
  ggtheme = theme_classic()
)

Adding Median Survival

ggsurvplot(
  fit,
  data = analysis,
  conf.int = TRUE,
  censor = TRUE,
  risk.table = TRUE,
  surv.median.line = "hv",
  xlab = "Time from Randomization (months)",
  ylab = "Overall Survival",
  ggtheme = theme_classic()
)

Median lines can be useful for teaching or exploratory analysis, but they should not replace a clearly reported median estimate and confidence interval in the accompanying results.

Controlling the X-Axis in R

ggsurvplot(
  fit,
  data = analysis,
  conf.int = TRUE,
  risk.table = TRUE,
  break.time.by = 6,
  xlim = c(0, 36),
  xlab = "Months from Randomization",
  ylab = "Survival Probability"
)

Use an explicit x-axis limit only when it is justified by the intended display. Always inspect whether observations or clinically relevant follow-up have been excluded from view.

Stratified Analyses

If the statistical analysis is stratified, do not assume that a visually stratified KM plot automatically reproduces the inferential analysis. The estimator, stratification, test, and model should be aligned with the prespecified analysis.

fit_strat <- survfit(
  Surv(AVAL, EVENT) ~ TRT01P,
  data = analysis,
  strata = analysis$STRATUM
)

The exact implementation depends on the analysis specification and software workflow. The key requirement is that the plotted population and estimator match the analysis being reported.

Production Workflow

1
Define the endpoint. Confirm event definition, censoring rules, and time origin.
2
Lock the analysis population. Confirm inclusion/exclusion criteria and treatment coding.
3
Validate time and event variables. Check impossible dates, negative times, duplicate records, and event coding.
4
Fit the KM estimator. Use the prespecified estimator and stratification conventions.
5
Check events and censoring. Reconcile counts against the source analysis dataset.
6
Build the figure. Add curves, censoring marks, confidence intervals, labels, and risk tables as specified.
7
Review the tail. Check whether sparse risk sets make late estimates unstable.
8
Validate against independent summaries. Reconcile n, events, medians, landmarks, and treatment labels.
9
Perform visual QC. Check axis limits, legend order, fonts, clipping, risk-table alignment, and censoring marks.
10
Archive the reproducible source. Retain the code, analysis dataset version, and figure-generation settings.

Common Mistakes

  1. Calling every curve “survival.” The endpoint should be named precisely.
  2. Omitting the numbers at risk. This hides how much information supports the tail of the curves.
  3. Removing censoring marks. The figure can then overstate the apparent continuity of observation.
  4. Reporting a median when 50% was never reached. Use “not reached” or the appropriate estimability language.
  5. Truncating the y-axis to exaggerate differences. The visual scale should support honest comparison.
  6. Using inconsistent time origins. A curve cannot be interpreted without knowing what time zero means.
  7. Ignoring competing risks. A standard KM estimator may not answer the desired cumulative-incidence question.
  8. Overinterpreting subgroup curves. Visual differences do not establish interaction.
  9. Assuming the plot proves a treatment effect. The figure is not a substitute for the prespecified inferential analysis.
  10. Failing to validate the risk table. Risk counts must correspond to the plotted analysis population and time convention.
  11. Showing an extremely long sparse tail without context. Late estimates may be supported by very few patients.
  12. Smoothing the KM curve. A smoothed curve is not the Kaplan-Meier estimator.

KM Plot Checklist

QuestionCheck
EndpointIs the exact event definition clear?
Time zeroIs the time origin stated?
PopulationDoes the figure use the prespecified analysis population?
CurvesAre treatment groups clearly and consistently identified?
CensoringAre censoring marks displayed appropriately?
UncertaintyAre confidence intervals included when appropriate?
Risk tableAre numbers at risk present and aligned with the x-axis?
MedianIs “not reached” handled correctly?
AxesAre units, limits, and ticks clinically sensible?
TailIs sparse follow-up apparent and discussed where relevant?
StatisticsAre p-values, hazard ratios, and other inferential results kept distinct from the graphic?
QCCan every displayed value be traced to the analysis dataset?

How to Read a KM Plot in a Clinical Study Report

Start with the endpoint and time origin. Then identify the treatment groups and inspect the early portion of the curves. Next examine whether the curves separate, converge, or cross, and whether the pattern changes over time.

Then inspect the risk table. If the curves remain separated after the risk sets become very small, be cautious about assigning substantial weight to that visual tail.

Finally, integrate the figure with the reported event counts, median estimates, confidence intervals, landmark estimates, and prespecified inferential analysis.

Bottom line: A strong Kaplan-Meier figure is not just aesthetically clean. It makes the time-to-event endpoint, treatment groups, censoring, uncertainty, and information remaining over time transparent. The most important best practice is alignment: the plot must faithfully represent the prespecified endpoint, population, estimator, and analysis conventions.

References

Kaplan, E.L., Meier, P. (1958). Nonparametric Estimation from Incomplete Observations. Journal of the American Statistical Association, 53(282), 457–481.
Brookmeyer, R., Crowley, J. (1982). A Confidence Interval for the Median Survival Time. Biometrics, 38(1), 29–41.
Peto, R., Peto, J. (1972). Asymptotically Efficient Rank Invariant Test Procedures. Journal of the Royal Statistical Society: Series A, 135(2), 185–207.
Therneau, T.M., Grambsch, P.M. (2000). Modeling Survival Data: Extending the Cox Model. Springer.
Klein, J.P., Moeschberger, M.L. (2003). Survival Analysis: Techniques for Censored and Truncated Data. Springer.