Skip to content
svgcullen-frey

Cullen–Frey graph

Which distribution families are compatible with the data's skewness and kurtosis?

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

How to read it

  1. Find the solid dot: your data's squared skewness and kurtosis.
  2. Read the shape of the bootstrap cloud for how uncertain that position is.
  3. See which family's point, line or region the cloud falls on.
  1. Callout 1: Your data.
  2. Callout 2: Bootstrap cloud: how much the position could vary.
  3. Callout 3: Named points: where exact families sit.

Watch out

  • Moments are noisy in small samples, and many families can fit. Check with a fit overlay.

Defaults

No settings: the chart draws one way.

Pinned in the code

  • Moments are the engine's unbiased sample skewness and kurtosis (kurtosis on the raw scale: normal = 3), as in fitdistrplus::descdist.
  • Theory is exact: normal (0, 3), uniform (0, 1.8), exponential (4, 9), logistic (0, 4.2); gamma on β₂ = 3 + 1.5 β₁; lognormal traced by σ; beta between β₂ = β₁ + 1 and the gamma line.
  • Kurtosis increases downward (the classical orientation). Bootstrap points show how uncertain the observed moments are.
# Cullen–Frey graph — Codesplash Chart Lab (recipe "cullen-frey")
# 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("cullen-frey-demo.csv", keep_default_na=False, na_values=[""])  # demo data (only empty cells are missing): Chart Lab → Code → Download demo CSV
df["kind"] = pd.Categorical(df["kind"].astype("string"), categories=["observed", "bootstrap"])

_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")
S = "skewness²"
K = "kurtosis"
KIND = "kind"
d = df.dropna(subset=[S, K]).rename(columns={S: "s", K: "k"})
boot = d[KIND].astype(str).str.contains("boot", case=False) if KIND else pd.Series(False, index=d.index)
obs, bs = d[~boot], d[boot]
x_max = max(4.0, np.ceil(obs["s"].max() * 1.25)) if len(obs) else 4.0
y_max = max(10.0, np.ceil(max(obs["k"].max() if len(obs) else 0, 3 + 1.5 * min(x_max, obs["s"].max() if len(obs) else 0)) * 1.15))
sig = np.arange(0.02, 3, 0.01)
w = np.exp(sig ** 2)
ln_s, ln_k = (w + 2) ** 2 * (w - 1), w ** 4 + 2 * w ** 3 + 3 * w ** 2 - 3  # lognormal (β1, β2)
keep = ln_s <= x_max
theory = {"normal": (0, 3), "uniform": (0, 1.8), "exponential": (4, 9), "logistic": (0, 4.2)}
fig, ax = plt.subplots(figsize=(8, 5))
ax.fill([0, x_max, x_max, 0], [1, x_max + 1, 3 + 1.5 * x_max, 3], color="#19966e", alpha=0.12, lw=0, label="beta")
ax.plot([0, x_max], [3, 3 + 1.5 * x_max], color=PALETTE[0], label="gamma")
ax.plot(ln_s[keep], ln_k[keep], color=PALETTE[1], linestyle="--", label="lognormal")
for name, (sx, kx) in theory.items():
    ax.scatter(sx, kx, marker="^", s=60, facecolors="none", edgecolors=REF)
    ax.annotate(name, (sx, kx), xytext=(-6 if sx > 0.8 * x_max else 6, 0), textcoords="offset points", ha="right" if sx > 0.8 * x_max else "left", va="center", fontsize=8)
ax.scatter(bs["s"], bs["k"], s=10, facecolors="none", edgecolors=GREY, label="bootstrap")
ax.scatter(obs["s"], obs["k"], s=50, color=plt.rcParams["text.color"], zorder=3, label="observed")
ax.set_xlim(0, x_max)
ax.set_ylim(y_max, 1)  # kurtosis increases downward (Cullen & Frey)
ax.set_xlabel("square of skewness")
ax.set_ylabel("kurtosis (normal = 3)")
ax.legend(fontsize=8, loc="lower left")
plt.show()

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