Skip to content
svglabbe

L'Abbé plot

Does the treatment's benefit depend on the baseline risk?

Demo data · seed 20261101 · 10 rows · default settings · 640 × 360SVG, lightSVG, darkDemo CSV

How to read it

  1. Read x as the control arm's risk, y as the treatment arm's.
  2. On the diagonal: no effect.
  3. Below the diagonal: treatment has fewer events; bubble size is the study's size.
  1. Callout 1: Larger study, near the diagonal.
  2. Callout 2: Below the diagonal: favours treatment.
  3. Callout 3: The no-difference line.

Watch out

  • A trend here doesn't prove baseline risk changes the effect: arm risks share measurement error.

Defaults

No settings: the chart draws one way.

Pinned in the code

  • Draws the meta-analysis engine's numbers as given (codesplash.stats.meta in Python ≡ codesplashr in R); the chart computes nothing statistical.
  • x = control (group 2) risk, y = treatment (group 1) risk, equal axes; marker area ∝ participants.
  • The diagonal is no difference; a constant risk ratio is a line through the origin.
# L'Abbé plot — Codesplash Chart Lab (recipe "labbe")
# controls: defaults
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt

try:
    import codesplash as cs  # optional: the app's chart theme
except ImportError:
    cs = None
if cs:
    cs.use_codesplash(dark=False)
PALETTE = cs.palette(dark=False)["categorical"] if cs else plt.rcParams["axes.prop_cycle"].by_key()["color"]

df = pd.read_csv("labbe-demo.csv", keep_default_na=False, na_values=[""])  # demo data (only empty cells are missing): Chart Lab → Code → Download demo CSV

_tokens = cs.palette(dark=False) if cs else {}
SEQ = _tokens.get("sequential", ["#eff6fd", "#1a469d"])  # sequential ramp (low → high)
DIV = _tokens.get("diverging", ["#c13e2e", "#f3f5f8", "#0859ac"])  # negative, midpoint, positive
REF = _tokens.get("reference", "#4e5661")
GREY = _tokens.get("dim", "#ced1d6")
R1 = "risk, treatment"
R2 = "risk, control"
WEIGHT = "participants"
LABEL = "study"
d = df.dropna(subset=[R1, R2])
hi = min(1.0, max(0.05, d[[R1, R2]].to_numpy().max()) * 1.1)
w = d[WEIGHT] if WEIGHT else pd.Series(1.0, index=d.index)
fig, ax = plt.subplots(figsize=(6, 6))
ax.plot([0, hi], [0, hi], color=REF, linestyle="--", linewidth=1)  # equal risk in both arms
ax.scatter(d[R2], d[R1], s=20 + 280 * w / w.max(), color=PALETTE[0], alpha=0.65, edgecolors=PALETTE[0])
if LABEL:
    for _, r in d.iterrows():
        ax.annotate(str(r[LABEL]), (r[R2], r[R1]), fontsize=7, xytext=(4, 3), textcoords="offset points")
ax.set_xlim(0, hi)
ax.set_ylim(0, hi)
ax.set_aspect("equal")
ax.set_xlabel(R2)
ax.set_ylabel(R1)
plt.show()

Needs pandas, numpy, matplotlib · reads labbe-demo.csv · app theme from the optional codesplash helper