Data visualization turns cleaned, enriched analysis tables into graphical views that reveal patterns, trends, comparisons, and changing values. An excitement arc plots game excitement by play, marks key moments, and adds a smoothed trend to expose momentum shifts. section 9.3.5
A practical visualization workflow includes:
- Prepare a compact DataFrame containing identifiers, measures, and grouping fields such as play number, excitement, key-moment status, inning number, and inning half. section 9.3.5
- Use a line plot for values over time, scatter points for notable observations, and a smoothed line for broader movement. section 9.3.5
- Finish with readable axis labels, a title, legend, grid, consistent y-axis limits, and notebook rendering. section 9.3.5
- Treat AI-generated scores and structured fields as variable: model versions, prompts, and settings can change individual results and chart shape. section 9.3.5
Game 7 excitement arc
Filter the enriched Game 7 DataFrame, plot excitement against play number, overlay red markers for key moments, and calculate a size-10 uniform-filter smoothing line. Compare the resulting arc with pitcher or batter summary charts built from the same enriched dataset. section 9.3.5 section 9.4
Listing 9.9 Setting Up the Excitement Visualization
import matplotlib.pyplot as plt #A
import seaborn as sns #A
from scipy.ndimage import uniform_filter1d #A
# Configure plot aesthetics
sns.set_style("whitegrid") #B
plt.rcParams["figure.figsize"] = (14, 6) #B
# Prepare a compact DataFrame for excitement analysis
excitement_df = df_enriched[ #C
["play_id", "excitement", "key_moment", "inning_number", "inning_half"]
].copy()
Use the visualization listings to inspect DataFrame preparation, plotting layers, smoothing, labels, and final rendering. section 9.3.5
















