liveBook · Manning

Baseline

As explained in Data Storytelling with Altair and AI

A baseline is a reference value or visual reference line used to compare observed values or improvements.

A baseline is a reference value or line that makes comparison immediate. Subtracting a starting value exposes change, while a horizontal threshold shows which results exceed a target. section 3.3.1 section 4.5.2

Use a baseline in two practical ways:

  • Normalize a time series by calculating each value’s difference from a chosen starting point, such as population in 1960. section 3.3.1
  • Add a horizontal reference line, such as 50% improvement, to show which categories outperform a decision threshold. section 4.5.2

Two kinds of comparison

For population trends, select the 1960 row, retrieve each series’ baseline value, and subtract it from every later value. For sports performance, add a red rule at y=50; bars above the line visibly exceed the baseline. section 3.3.1 section 4.5.2

Listing 3.27 Calculating the difference
baseline = df_melt[df_melt['Year'] == 1960]

continents = ['North America', 'World']
for continent in continents:
    baseline_value = baseline[baseline['Continent'] == continent]['Population'].values[0]
    m = df_melt['Continent'] == continent
    df_melt.loc[m, 'Diff'] = df_melt.loc[m,'Population'] - baseline_value

Inspect the calculation that selects 1960 values and writes each series’ difference into a new Diff column. section 3.3.1

How Data Storytelling with Altair and AI covers it

How deep it goes
Explains baseline subtraction and threshold-line construction with runnable charting steps, stopping short of broader statistical treatment.
Examples
Demonstrates population change from 1960 and sports improvement against a 50% threshold.
What you can do after
Build it from scratch by calculating comparison differences and adding a reference rule to an Altair chart.
How it connects
Connects baselines with data visualization, Altair, pandas, information, and knowledge.

Also explained in

Compare how 16 books explain baseline →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Data Storytelling with Altair and AI. The section links point to the parts of the book it draws on.