Skip to content
svgbaujat

Baujat plot

Which studies both create heterogeneity and pull the pooled result?

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

How to read it

  1. Read x as a study's contribution to heterogeneity.
  2. Read y as its influence on the pooled result.
  3. Top-right studies do both: check them first.
  1. Callout 1: This study both adds heterogeneity and moves the pooled result.
  2. Callout 2: Most studies cluster here.

Watch out

  • Don't remove a study because it sits here. Find out why it differs.

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 = (yᵢ − θ̂_FE)²/vᵢ; y = (θ̂ − θ̂₍₋ᵢ₎)² / Var(θ̂₍₋ᵢ₎) from leave-one-out fits.
  • The four studies furthest from the origin (on axes scaled to their maxima) are labelled.
# Baujat plot — Codesplash Chart Lab (recipe "baujat")
# 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("baujat-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")
X = "contribution to Q"
Y = "influence on the pooled estimate"
LABEL = "study"
d = df.dropna(subset=[X, Y]).copy()
d["_reach"] = d[X] / d[X].max() + d[Y] / d[Y].max()  # distance from the origin on normalized axes
fig, ax = plt.subplots(figsize=(7, 5))
ax.scatter(d[X], d[Y], s=30, color=PALETTE[0])
for _, r in d.nlargest(4, "_reach").iterrows():
    ax.annotate(str(r[LABEL]), (r[X], r[Y]), fontsize=8, xytext=(5, 3), textcoords="offset points")
ax.set_xlim(0, d[X].max() * 1.1)
ax.set_ylim(0, d[Y].max() * 1.1)
ax.set_xlabel(X)
ax.set_ylabel(Y)
plt.show()

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