Skip to content
svgtornado

Tornado diagram

Which uncertain inputs move the outcome most when each is varied alone?

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

How to read it

  1. Read bars top down: the inputs that move the output most.
  2. Read each side as the input's low or high value, with others held at base.
  3. Focus effort on the top bars.
  1. Callout 1: The most influential input.
  2. Callout 2: A small swing: this input matters little.
  3. Callout 3: The base-case output.

Watch out

  • It varies one input at a time, so it misses interactions: use a Monte Carlo run for those.

Defaults

Base-case output
1,240
The output with every input at its base value; bars diverge from here.
Range -1,000,000,000,000 to 1,000,000,000,000, step 1

Pinned in the code

  • Draws the run's numbers as given (computed by the Python/R engine); the chart computes nothing statistical.
  • One-way sensitivity: each input moves to its low and high value (e.g. P10 and P90) with every other input at its base case; bars run from the base-case output.
  • Interactions between inputs are invisible here — use Sobol indices or Monte Carlo for joint uncertainty.
# Tornado diagram — Codesplash Chart Lab (recipe "tornado")
# controls: base=1240
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("tornado-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")
INPUT = "input"
LO = "NPV ($k) at low"
HI = "NPV ($k) at high"
BASE = 1240
d = df.dropna(subset=[INPUT, LO, HI]).assign(swing=lambda t: (t[HI] - t[LO]).abs()).sort_values("swing")  # widest on top
base = BASE if BASE is not None else (d[LO].iloc[-1] + d[HI].iloc[-1]) / 2
fig, ax = plt.subplots(figsize=(8, 4.5))
y = np.arange(len(d))
ax.barh(y, d[LO] - base, left=base, color=PALETTE[1], label="input at its low value")
ax.barh(y, d[HI] - base, left=base, color=PALETTE[0], label="input at its high value")
ax.axvline(base, color="black", linewidth=1.2)
ax.set_yticks(y, d[INPUT].astype(str))
ax.set_xlabel("output")
ax.legend(fontsize=8)
plt.show()

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