MakeoverMonday: 2025 Market Events - Interactive Dashboard

MakeoverMonday
Data Viz
Python
Finance
An interactive visualization of S&P500 and Nikkei 225 with trend shading and event markers using Plotly
Author

chokotto

Published

January 13, 2026

Overview

This MakeoverMonday project transforms the 2025 market events data into an interactive dashboard. Unlike static charts, this Plotly-based visualization allows users to:

  • Hover over events to see details
  • Zoom into specific time periods
  • Toggle between indices
  • Explore trend periods interactively

Original Visualization

Source: Custom market events dataset; index closes from FRED (SP500, NIKKEI225)

The original data consists of CSV files with event dates and trend periods. This makeover creates an interactive experience from that static data. Each event’s daily move is computed from the index closes (close-to-close change on the event date).

Dataset

import pandas as pd
import plotly.graph_objects as go
from plotly.subplots import make_subplots
# All inputs are pinned in data/ by prepare_data.py (FRED closes for 2025)
events = pd.read_csv("data/events_2025.csv", parse_dates=["date"])
trends = pd.read_csv("data/trend_periods_2025.csv", parse_dates=["start_date", "end_date"])

print(f"Loaded {len(events)} events and {len(trends)} trend periods")
events[["date", "market", "category", "event_label"]].head()
Loaded 19 events and 12 trend periods
date market category event_label
0 2025-01-15 US INFLATION CPI Cooled
1 2025-01-24 JP MONETARY_POLICY BOJ Hike 0.5%
2 2025-01-29 US MONETARY_POLICY FOMC Hold
3 2025-03-03 US TARIFF Tariff Shock
4 2025-04-03 BOTH TARIFF Reciprocal Tariffs
def read_index(path):
    df = pd.read_csv(path, parse_dates=["date"]).sort_values("date")
    df["daily_change"] = df["value"].pct_change() * 100
    return df

sp500 = read_index("data/sp500.csv")
nikkei = read_index("data/nikkei225.csv")

# Event moves are computed from the closes, not typed in
events = events.merge(
    sp500[["date", "daily_change"]].rename(columns={"daily_change": "sp500_move"}),
    on="date", how="left"
)
print(f"S&P 500: {len(sp500)} trading days / Nikkei 225: {len(nikkei)} trading days")
S&P 500: 250 trading days / Nikkei 225: 243 trading days

My Makeover

What I Changed

  • Static → Interactive: Converted from ggplot2-style static chart to fully interactive Plotly
  • Dual Y-axis: Added secondary axis for Nikkei 225 (different scale)
  • Hover Details: Event information appears on hover
  • Range Selector: Added buttons for 1M, 3M, 6M, YTD views
  • Annotations: Key events labeled directly on chart

Main Visualization

# Create figure with secondary y-axis
fig = make_subplots(specs=[[{"secondary_y": True}]])

# Add trend shading (US trends)
us_trends = trends[trends['market'] == 'US']
for _, trend in us_trends.iterrows():
    color = "rgba(34, 197, 94, 0.15)" if trend['trend_type'] == 'UP' else "rgba(239, 68, 68, 0.15)"
    fig.add_vrect(
        x0=trend['start_date'].strftime('%Y-%m-%d'),
        x1=trend['end_date'].strftime('%Y-%m-%d'),
        fillcolor=color,
        line_width=0,
        # Shapes added before any trace are skipped as "empty subplot" by default
        exclude_empty_subplots=False
    )

# Add S&P 500 line
fig.add_trace(
    go.Scatter(
        x=sp500['date'],
        y=sp500['value'],
        name="S&P 500",
        line=dict(color="#2563eb", width=2),
        hovertemplate="<b>S&P 500</b><br>Date: %{x|%Y-%m-%d}<br>Value: %{y:,.0f}<extra></extra>"
    ),
    secondary_y=False
)

# Add Nikkei 225 line
fig.add_trace(
    go.Scatter(
        x=nikkei['date'],
        y=nikkei['value'],
        name="Nikkei 225",
        line=dict(color="#dc2626", width=2),
        hovertemplate="<b>Nikkei 225</b><br>Date: %{x|%Y-%m-%d}<br>Value: %{y:,.0f}<extra></extra>"
    ),
    secondary_y=True
)

# Add event markers
us_events = events[events['market'].isin(['US', 'BOTH'])]
major_events = us_events[us_events['sp500_move'].abs() > 1.5]

for _, event in major_events.iterrows():
    fig.add_vline(
        x=event['date'].strftime('%Y-%m-%d'),
        line_dash="dash",
        line_color="#94a3b8",
        line_width=1
    )

# Update layout
fig.update_layout(
    title=dict(
        text="<b>2025 Market Events: S&P 500 vs Nikkei 225</b><br><sup>Trend periods (shaded) and major events (dashed lines)</sup>",
        x=0.5,
        font=dict(size=18)
    ),
    xaxis=dict(
        title="",
        rangeselector=dict(
            buttons=list([
                dict(count=1, label="1M", step="month", stepmode="backward"),
                dict(count=3, label="3M", step="month", stepmode="backward"),
                dict(count=6, label="6M", step="month", stepmode="backward"),
                dict(step="all", label="YTD")
            ]),
            bgcolor="rgba(255,255,255,0.9)",
            bordercolor="#e2e8f0"
        ),
        rangeslider=dict(visible=True),
        type="date"
    ),
    yaxis=dict(
        title="S&P 500",
        tickformat=",",
        side="left"
    ),
    yaxis2=dict(
        title="Nikkei 225",
        tickformat=",.0f",
        side="right"
    ),
    legend=dict(
        orientation="h",
        yanchor="bottom",
        y=1.02,
        xanchor="right",
        x=1
    ),
    template="plotly_white",
    height=550,
    margin=dict(t=120, b=80)
)

fig.show()

# Save first chart as static image for X post
fig.write_image("chart-1.png", width=1200, height=600, scale=2)

Event Impact Analysis

# Create bar chart of event impacts
events_with_impact = events[events['market'].isin(['US', 'BOTH']) & events['sp500_move'].notna()].copy()
events_with_impact['color'] = events_with_impact['sp500_move'].apply(
    lambda x: '#22c55e' if x > 0 else '#ef4444'
)
events_with_impact = events_with_impact.sort_values('sp500_move')

fig2 = go.Figure()

fig2.add_trace(go.Bar(
    y=events_with_impact['event_label'],
    x=events_with_impact['sp500_move'],
    orientation='h',
    marker_color=events_with_impact['color'],
    text=events_with_impact["sp500_move"].apply(lambda x: f"{0.0 if abs(x) < 0.005 else x:+.2f}%"),
    textposition='outside',
    hovertemplate="<b>%{y}</b><br>S&P 500 Change: %{x:.2f}%<extra></extra>"
))

fig2.update_layout(
    title=dict(
        text="<b>S&P 500 Daily Change by Event</b>",
        x=0.5
    ),
    xaxis_title="Daily Change (%)",
    yaxis_title="",
    template="plotly_white",
    height=450,
    margin=dict(l=150)
)

# Add zero line
fig2.add_vline(x=0, line_color="#64748b", line_width=1)

fig2.show()

Trend Period Summary

# Create trend period table
us_trends_display = trends[trends['market'] == 'US'].copy()
us_trends_display['duration'] = (us_trends_display['end_date'] - us_trends_display['start_date']).dt.days
us_trends_display['period'] = us_trends_display['start_date'].dt.strftime('%b %d') + ' - ' + us_trends_display['end_date'].dt.strftime('%b %d')

us_trends_display[['period', 'trend_type', 'trigger_event', 'duration', 'description']]
period trend_type trigger_event duration description
0 Jan 01 - Mar 02 UP Post-2024 Rally 60 New year rally continuation before tariff conc...
2 Mar 03 - Apr 08 DOWN Tariff Shock 36 Sharp decline triggered by tariff announcement...
4 Apr 09 - Apr 09 UP 90-Day Pause 0 Single-day historic rally on tariff pause anno...
6 Apr 10 - May 12 DOWN Tariff Uncertainty 32 Post-rally pullback amid ongoing tariff uncert...
7 May 13 - Sep 16 UP US-China Truce 126 Risk-on rally following US-China tariff truce ...
9 Sep 17 - Nov 12 UP Fed Easing Cycle 56 Rally driven by Fed rate cuts starting September
10 Nov 13 - Dec 09 DOWN Rate Cut Doubts 26 Pullback as rate cut expectations fade
11 Dec 10 - Dec 31 UP Year-End Rally 21 Year-end rally following December Fed cut

Key Takeaways

  1. Interactive Exploration: Users can zoom into specific periods (e.g., April tariff shock) to examine price action in detail.

  2. Dual Index Comparison: The secondary Y-axis allows direct comparison of S&P 500 and Nikkei 225 movements, revealing correlation during global events.

  3. Trend Visualization: Shaded regions make it easy to identify bull and bear phases at a glance.

  4. Event Context: Hover information provides instant context for each market event.

  5. April 2025 Volatility: The tariff shock week saw the S&P 500 fall -4.84% (April 3) and -5.97% (April 4, the largest drop of 2025), then jump +9.52% on the 90-day pause (April 9). The Nikkei 225 fell -7.83% on April 7 and rose +9.13% on April 10.


This post is part of the MakeoverMonday weekly data visualization project.

Caution⚠️ Disclaimer

This analysis is for educational and practice purposes only. Data visualizations and interpretations are based on the provided dataset and may not represent complete or current information. Index closes are from FRED (SP500, NIKKEI225); event moves are computed from those closes.