Skip to content
svgspider

Spider plot

How steeply does the output respond as each input moves away from its base value?

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

How to read it

  1. Read each line as the output as one input moves from base.
  2. Steeper means more sensitive.
  3. All lines cross at the base case.
  1. Callout 1: A steep line: a sensitive input.
  2. Callout 2: The base case.
  3. Callout 3: This input lowers the output as it rises.

Watch out

  • A percent change isn't equally likely for every input, so steepness alone doesn't rank risks.

Defaults

No settings: the chart draws one way.

Pinned in the code

  • Draws the run's numbers as given (computed by the Python/R engine); the chart computes nothing statistical.
  • Changes within ±2 are read as fractions (−0.2 = −20%), larger values as percent; the dashed line is the output at zero change.
# Spider plot — Codesplash Chart Lab (recipe "spider")
# 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("spider-demo.csv", keep_default_na=False, na_values=[""])  # demo data (only empty cells are missing): Chart Lab → Code → Download demo CSV

def levels_of(s):
    """Declared level order (categoricals), else order of first appearance."""
    if isinstance(s.dtype, pd.CategoricalDtype):
        return [v for v in s.cat.categories if (s == v).any()]
    return list(dict.fromkeys(s.dropna().astype(str)))
CH = "change from base"
K = "NPV ($k)"
INPUT = "input"
groups = levels_of(df[INPUT]) if INPUT else [None]
series = []
for name in groups:
    d = df if name is None else df[df[INPUT].astype(str) == str(name)]
    series.append((name if name is not None else "", d.dropna(subset=[CH]).sort_values(CH)))
fig, ax = plt.subplots(figsize=(8, 4.5))
ax.axvline(0, color="grey", linewidth=0.8)
for i, (name, d) in enumerate(series):
    ax.plot(d[CH], d[K], marker="o", ms=4, color=PALETTE[i % len(PALETTE)], linewidth=1.8, label=name)
ax.set_xlabel(CH)
ax.set_ylabel(K)
ax.legend(fontsize=8)
plt.show()

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