Menu

CLINICAL RESEARCH

Kaplan-Meier Survival Curves

Generate publication-ready survival curves with log-rank tests, risk tables, confidence intervals, and censoring marks using Python and matplotlib.

Essential Survival Analysis Visualizations

Survival analysis tracks time-to-event data - from patient mortality in clinical trials to equipment failure in engineering. The Kaplan-Meier estimator is the standard non-parametric approach, with several complementary visualizations used in published research.

Two-Group KM

Treatment vs control with log-rank p-value and confidence bands

Multi-Arm Comparison

Three or more cohort curves with pairwise significance tests

At-Risk Table

Number of subjects remaining at risk beneath the curve at each time point

Confidence Intervals

95% CI bands using Greenwood formula to quantify estimation uncertainty

Cumulative Hazard

Nelson-Aalen estimator as complement to survival probability

Restricted Mean Survival

RMST summary statistic at a landmark time for clinical reporting

Why Clinical Researchers Use Plotivy

Zero External Dependencies

Pure numpy/matplotlib implementation with manual Kaplan-Meier, Greenwood CI, and log-rank testing - no extra packages needed.

Log-Rank Testing

Automatic log-rank p-value printed on the curve for two or more groups with multivariate support.

Censoring Marks

Tick marks placed at censored observations so reviewers see the complete dataset at a glance.

Publication Style

Spine cleanup, Arial font, 300 DPI export ready for journal submission to Nature Medicine or NEJM.

Treatment vs Control Survival

Two-group Kaplan-Meier with log-rank test and censoring tick marks. Edit the exponential scale parameters to model faster or slower event rates in your treatment arms.

Live Code Editor
Code EditorPython
Loading editor...
Live Preview

Preparing preview

Running once automatically on first load

Learn by Experimenting

This is a safe playground for learning! Try changing:

  • • Colors: Modify color values to see different palettes
  • • Numbers: Adjust sizes, positions, or data ranges
  • • Labels: Update titles, axis names, or legends

Edit the code, run it, then open the full data visualization tool to continue with your own dataset.

Try with your data

Built-In Datasets

These biology datasets work well as demo data for survival-style analysis. Upload your own time-to-event CSV for real survival curves.

Three-Arm Trial: KM + Cumulative Hazard

Dose-escalation trial with Placebo, Low Dose, and High Dose arms. Panel A shows KM survival curves with multivariate log-rank test. Panel B shows the Nelson-Aalen cumulative hazard as a complement.

Live Code Editor
Code EditorPython
Loading editor...
Live Preview

Preparing preview

Running once automatically on first load

Learn by Experimenting

This is a safe playground for learning! Try changing:

  • • Colors: Modify color values to see different palettes
  • • Numbers: Adjust sizes, positions, or data ranges
  • • Labels: Update titles, axis names, or legends

Edit the code, run it, then open the full data visualization tool to continue with your own dataset.

Chart gallery

Explore Related Chart Types

Interactive examples with ready-to-run code

Browse all chart types →
Violin plot comparing score distributions across 3 groups with inner box plots
Distribution•seaborn, matplotlib
From the chart gallery•Comparing treatment effects across groups

Violin Plot

Combines box plots with kernel density to show distribution shape across groups.

Sample code / prompt

import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
import numpy as np
from scipy.stats import f_oneway

# Generate exam score data for 3 groups
np.random.seed(42)
control = np.random.normal(72, 12, 50)
treatment_a = np.random.normal(78, 10, 50)
Correlation heatmap with diverging color scale and coefficient annotations
Statistical•seaborn, matplotlib
From the chart gallery•Correlation analysis between variables

Heatmap

Represents data values as colors in a two-dimensional matrix format.

Sample code / prompt

import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
import numpy as np

# Create correlation matrix for financial metrics
metrics = ['Revenue', 'Profit', 'Expenses', 'ROI', 'Customers', 'AOV', 'Marketing', 'Employees']
correlation_data = np.array([
    [1.00, 0.85, -0.45, 0.72, 0.88, 0.65, 0.72, 0.55],
    [0.85, 1.00, -0.78, 0.92, 0.75, 0.58, 0.63, 0.48],

Ready to Analyze Survival Data?

Upload your time-to-event CSV, describe the survival plot you need, and get publication-ready figures with full Python code in seconds.

Start Free - No Sign-Up