Skip to content
svgmeta-funnel

Funnel plot (contour-enhanced)

Are small studies' effects distributed symmetrically around the pooled effect?

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

How to read it

  1. Read y as precision: large studies at the top.
  2. Without bias, points form a symmetric funnel around the pooled effect.
  3. Look for a missing corner: small studies with unfavourable results may be absent.
  1. Callout 1: Precise studies at the top.
  2. Callout 2: Imputed studies fill the gap.
  3. Callout 3: A missing corner.

Watch out

  • Asymmetry isn't only publication bias: true heterogeneity and small-study differences produce it too.

Defaults

Significance contours
On
Shade where a study would be significant at p < .10, .05 and .01 (two-sided, against zero).

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.
  • The y axis is the standard error, reversed so the most precise studies sit at the top (Sterne & Egger 2001).
  • Dashed lines: the pooled estimate ± 1.96·SE (engine control `center`). Shaded wedges: |effect| ≥ z·SE for p = .10, .05, .01 around zero (Peters et al. 2008).
  • Open circles are studies imputed by trim-and-fill; the dotted vertical line is the adjusted estimate. The solid coloured line is Egger's regression (effect = intercept + slope·SE).
# Funnel plot (contour-enhanced) — Codesplash Chart Lab (recipe "meta-funnel")
# controls: contours=true
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from scipy import stats

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("meta-funnel-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")
EST = "log risk ratio"
SE = "standard error"
KIND = "study"
CENTER, ADJUSTED, CONTOURS = None, None, True
EGGER_B0, EGGER_B1 = None, None
d = df.dropna(subset=[EST, SE])
imputed = d[KIND].astype(str).eq("imputed") if KIND else pd.Series(False, index=d.index)
se_max = d[SE].max() * 1.08
fig, ax = plt.subplots(figsize=(7, 5.5))
if CONTOURS:  # where a study would be significant against zero (p 0.10–0.05, 0.05–0.01, < 0.01)
    z = stats.norm.ppf([0.95, 0.975, 0.995])
    span = max(d[EST].abs().max(), z[2] * se_max) * 1.05
    for lo, hi, alpha in ((z[0], z[1], 0.10), (z[1], z[2], 0.18), (z[2], None, 0.28)):
        outer = [span, span] if hi is None else [0, hi * se_max]
        for side in (-1, 1):
            ax.fill_betweenx([0, se_max], [0, side * lo * se_max], [side * v for v in outer], color=REF, alpha=alpha, lw=0)
if CENTER is not None:
    z95 = stats.norm.ppf(0.975)
    ax.plot([CENTER - z95 * se_max, CENTER, CENTER + z95 * se_max], [se_max, 0, se_max], color=REF, linestyle="--", linewidth=1)
    ax.axvline(CENTER, color=REF, linewidth=1)
if ADJUSTED is not None:
    ax.axvline(ADJUSTED, color=PALETTE[1], linestyle=":", linewidth=1.2, label="adjusted")
if EGGER_B0 is not None and EGGER_B1 is not None:
    ax.plot([EGGER_B0, EGGER_B0 + EGGER_B1 * se_max], [0, se_max], color=PALETTE[2], linewidth=1.2, label="Egger line")
ax.scatter(d.loc[~imputed, EST], d.loc[~imputed, SE], s=28, color=PALETTE[0], zorder=3, label="study")
if imputed.any():
    ax.scatter(d.loc[imputed, EST], d.loc[imputed, SE], s=28, facecolors="none", edgecolors=PALETTE[0], zorder=3, label="imputed")
ax.set_ylim(se_max, 0)  # the most precise studies at the top
ax.set_xlabel(EST)
ax.set_ylabel(SE)
ax.legend(fontsize=8, loc="lower right")
plt.show()

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