Data Visualization for Football

Beginner 10 min read 1 views Nov 27, 2025
# Data Visualization for Football ## Python Example: Field Position Visualization ```python import matplotlib.pyplot as plt import matplotlib.patches as patches import numpy as np def create_field_viz(play_data): """Visualize plays on football field""" fig, ax = plt.subplots(figsize=(12, 5)) # Draw field ax.set_xlim(0, 120) ax.set_ylim(0, 53.3) ax.set_aspect('equal') # Yard lines for yard in range(0, 120, 10): ax.axvline(x=yard, color='white', linewidth=0.5) # Example: Heat map of target areas x = np.random.uniform(20, 100, 50) y = np.random.uniform(0, 53.3, 50) ax.hexbin(x, y, gridsize=15, cmap='YlOrRd', alpha=0.6) ax.set_facecolor('#2e7d32') ax.set_title('Pass Target Heat Map', fontsize=14, fontweight='bold') ax.set_xlabel('Yard Line') ax.set_ylabel('Field Width (yards)') return fig create_field_viz(None) plt.show() ``` ## R Example: Dashboard-Style Reporting ```r library(ggplot2) library(gridExtra) # Create multi-panel dashboard for coaches create_coaching_dashboard <- function(team_data) { # Plot 1: Offensive efficiency p1 <- ggplot(data.frame(down = 1:4, epa = c(0.15, -0.05, -0.25, -0.5)), aes(x = factor(down), y = epa, fill = epa > 0)) + geom_bar(stat = "identity") + labs(title = "EPA by Down", x = "Down", y = "EPA") + theme_minimal() + theme(legend.position = "none") # Plot 2: Success rate trends p2 <- ggplot(data.frame(week = 1:10, success_rate = c(0.45, 0.48, 0.52, 0.50, 0.55, 0.53, 0.56, 0.58, 0.54, 0.60)), aes(x = week, y = success_rate)) + geom_line(size = 1.2, color = "blue") + geom_point(size = 3, color = "blue") + labs(title = "Success Rate Trend", x = "Week", y = "Success Rate") + theme_minimal() # Combine plots grid.arrange(p1, p2, ncol = 2) } create_coaching_dashboard(NULL) ```

Discussion

Have questions or feedback? Join our community discussion on Discord or GitHub Discussions.