Skip to content
svggosh

GOSH plot (all study subsets)

Does the pooled result depend on which studies are included, and do the subsets fall into clusters?

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

How to read it

  1. Read each point as one subset of the studies: x is its pooled estimate, y its I².
  2. A single compact cloud means the answer barely depends on which studies are in.
  3. Separate clouds, or a colour that sits apart, point to a study (or group) that differs from the rest.
  1. Callout 1: Marginal histogram of the subsets' estimates.
  2. Callout 2: Subsets without the flagged study.
  3. Callout 3: Subsets with it: shifted and more heterogeneous.

Watch out

  • Clusters suggest where to look; they are not a test, and a flagged study is a reason to reread it, not to drop it.
  • With few studies there are few subsets, and the cloud has little structure to read.

Defaults

All-studies estimate
0
The estimate from all studies, drawn as a solid vertical line.
Range -1,000,000 to 1,000,000, step 0.01
Null value
0
Where 'no effect' sits on the analysis scale (dashed).
Range -1,000,000 to 1,000,000, step 0.1

Pinned in the code

  • Draws the meta-analysis engine's numbers as given (codesplash.stats.meta_lab in Python ≡ codesplashr in R); the chart computes nothing statistical.
  • x is the subset's pooled estimate on the analysis scale (log for ratios), y its I² = (Q − df)/Q in percent; single-study subsets sit at I² = 0.
  • When 2^k − 1 exceeds the method's limit the engine fits a seeded random sample of subsets; very large clouds are thinned evenly for drawing (the result says so).
  • Colour marks the subsets that contain the study whose inclusion shifts the subsets' mean estimate most (engine column `group`).
# GOSH plot (all study subsets) — Codesplash Chart Lab (recipe "gosh")
# controls: center=0, reference=0
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("gosh-demo.csv", keep_default_na=False, na_values=[""])  # demo data (only empty cells are missing): Chart Lab → Code → Download demo CSV
df["subset"] = pd.Categorical(df["subset"].astype("string"), categories=["with Study 7", "without Study 7"])

_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 odds ratio"
I2 = "I² (%)"
GROUP = "subset"
CENTER, REFERENCE = 0, 0  # all-studies estimate; null value
d = df.dropna(subset=[EST, I2])
groups = sorted(d[GROUP].astype(str).unique(), key=lambda g: not g.startswith("with ")) if GROUP else [None]
fig = plt.figure(figsize=(7, 6))
grid = fig.add_gridspec(2, 2, width_ratios=(5, 1), height_ratios=(1, 5), hspace=0.05, wspace=0.05)
ax = fig.add_subplot(grid[1, 0])
top = fig.add_subplot(grid[0, 0], sharex=ax)
side = fig.add_subplot(grid[1, 1], sharey=ax)
for i, g in enumerate(groups):
    s = d if g is None else d[d[GROUP].astype(str) == g]
    ax.scatter(s[EST], s[I2], s=4, alpha=0.5, color=PALETTE[i], label=g or "subset", linewidths=0)
    top.hist(s[EST], bins=40, color=PALETTE[i], alpha=0.45)
    side.hist(s[I2], bins=40, range=(0, 100), orientation="horizontal", color=PALETTE[i], alpha=0.45)
ax.axvline(REFERENCE, color=REF, linestyle="--", linewidth=1)
ax.axvline(CENTER, color="black", linewidth=1.2, label="all studies")
ax.set_ylim(0, 100)
ax.set_xlabel(EST)
ax.set_ylabel(I2)
top.axis("off")
side.axis("off")
ax.legend(frameon=False, loc="upper left")
plt.show()

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