Skip to content
svgcapability-histogram

Process capability

Does the process fit inside its specification limits, and how much falls outside?

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

How to read it

  1. Read the histogram and curve as the process output.
  2. Compare with the red specification limits.
  3. Read the indices at the top: how comfortably the process fits.
  1. Callout 1: The lower specification limit.
  2. Callout 2: The upper specification limit.
  3. Callout 3: A process centred away from the target.
  4. Callout 4: Pp, Ppk and the share outside.

Watch out

  • Capability assumes a stable process and a suitable distribution. Check the control chart first.

Defaults

Lower specification limit (null = none)
9.95
The smallest value the requirement accepts.
Range -1,000,000,000 to 1,000,000,000, step 0.001
Upper specification limit (null = none)
10.05
The largest value the requirement accepts.
Range -1,000,000,000 to 1,000,000,000, step 0.001
Target (null = none)
10
The outcome you want to reach; the chart shows the chance of missing it.
Range -1,000,000,000 to 1,000,000,000, step 0.001

Pinned in the code

  • Bins: equal width over the values and limits (at least 10, Sturges otherwise). The fitted curve is the engine's (normal or a Box–Cox/Johnson fit, as sent); without one, a normal density with the sample mean and SD.
  • Pp/Ppk in the legend use the overall (long-term) SD of the plotted values; Cp/Cpk from within-subgroup variation come from the engine's capability table.
  • Specification limits are customer requirements, not control limits; send null for a one-sided specification.
# Process capability — Codesplash Chart Lab (recipe "capability-histogram")
# controls: lsl=9.95, usl=10.05, target=10
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("capability-histogram-demo.csv", keep_default_na=False, na_values=[""])  # demo data (only empty cells are missing): Chart Lab → Code → Download demo CSV

V = "diameter (mm)"
FX = None
FD = None
LSL, USL, TARGET = 9.95, 10.05, 10
v = df[V].dropna()
lims = [x for x in (LSL, USL) if x is not None]
edges = np.linspace(min([v.min()] + lims), max([v.max()] + lims), max(10, int(np.ceil(np.log2(len(v)) + 1))) + 1)
fig, ax = plt.subplots(figsize=(8, 4.5))
ax.hist(v, bins=edges, density=True, color=PALETTE[0], alpha=0.45, edgecolor="white")
if FX and FD:
    f = df.dropna(subset=[FX, FD]).sort_values(FX)
    ax.plot(f[FX], f[FD], color=PALETTE[0], linewidth=2)
else:  # normal with the sample mean and SD (overall)
    xs = np.linspace(edges[0], edges[-1], 200)
    ax.plot(xs, stats.norm.pdf(xs, v.mean(), v.std(ddof=1)), color=PALETTE[0], linewidth=2)
for x, name, col, ls in ((LSL, "LSL", "#ce5342", "--"), (USL, "USL", "#ce5342", "--"), (TARGET, "target", "#19966e", ":")):
    if x is not None:
        ax.axvline(x, color=col, linestyle=ls, linewidth=1.4)
        ax.annotate(name, (x, 1), xycoords=("data", "axes fraction"), ha="center", va="bottom", fontsize=8, color=col)
s = v.std(ddof=1)
if LSL is not None and USL is not None:
    ax.set_title(f"Pp {(USL - LSL) / (6 * s):.3f} · Ppk {min((USL - v.mean()) / (3 * s), (v.mean() - LSL) / (3 * s)):.3f}", fontsize=9, loc="left")
ax.set_xlabel(V)
ax.set_ylabel("density")
plt.show()

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