Create indexed comparison charts from Federal Reserve Economic Data (FRED) series.
For a simple two-series comparison:
bash
python3 scripts/fred_chart.py --config chart_config.json --output chart.png
Find series IDs at fred.stlouisfed.org:
IndicatorCommon SeriesReal GDPGDPC1GDP Per CapitaA939RX0Q048SBEA (or compute from GDPC1 + POPTHM)Compensation Per HourCOMPRNFBMedian Weekly EarningsLES1252881600QCorporate ProfitsCPCPICPIAUCSLUnemploymentUNRATE
json
{
"title": "USA: GDP vs Wages (1959 = 100)",
"series": [
{
"id": "A939RX0Q048SBEA",
"label": "Real GDP Per Capita",
"color": "#2E86AB"
},
{
"id": "COMPRNFB",
"label": "Real Compensation Per Hour",
"color": "#F18F01"
}
],
"start_date": "1959-01-01",
"end_date": "2026-12-31",
"fill_gap": true,
"annotations": [
{
"date": "1971-08-15",
"label": "Nixon Shock",
"position": "top",
"y": 140
}
]
}
Config fields:
title: Chart titleseries[].id: FRED series IDseries[].label: Legend labelseries[].color: Optional hex colorstart_date/ end_date: Date range filterfill_gap: Shade area between first two series (default: true)annotations[].date: Event date (YYYY-MM-DD)annotations[].label: Event text (supports newlines with \n)annotations[].position: "top" or "bottom"annotations[].y: Vertical position for label placementbash
python3 scripts/fred_chart.py --config my_chart.json --output my_chart.png
When FRED lacks a direct GDP per capita series, compute it from GDP ( GDPC1) and population ( POPTHM):
python
# gdp_pc = (GDP in billions * 1e9) / (Population in thousands * 1e3)
# Or use the pre-computed series: A939RX0Q048SBEA (available from 1979)
# For earlier dates, manual calculation required
\n for multi-line labels. Position alternates top/bottom to avoid overlapstart_date/ end_date to focus on specific eras (e.g., 1959-1985)PatternSeriesUse CaseProductivity-Pay GapA939RX0Q048SBEA, COMPRNFBShow worker compensation vs economic outputWage-Inflation ComparisonCES0500000003, CPIAUCSLReal vs nominal wage growthProfit-Wage DivergenceCP, COMPRNFBWhere surplus goesHistorical EventsAny + annotationsAnnotated economic timeline