Skip to content

Generate customizable radar charts to compare football players using saved HTML data.

Notifications You must be signed in to change notification settings

marcusrprojects/fbref-comparison-radar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FBRef Player Comparison Radar Chart Generator

Language Python Version Libraries

Description

This project provides a Python script (multi_player_radar.py) to generate customizable radar (spider) charts from saved HTML files from FBRef.com's player comparison tool. It extracts relevant statistics, computes per 90-minute values, and visualizes comparisons between players using matplotlib.

⚠️ Disclaimer: This tool is for personal and educational use only. It does not scrape FBRef.com or interact with their servers. Users must manually download HTML files and use them locally. Please ensure you comply with FBRef's Terms of Use.

Features

  • Parses statistics from user-saved FBRef Player Comparison HTML pages
  • Compares multiple players based on specified statistics
  • Computes per-90-minute values for applicable metrics
  • Customizable radar charts:
    • Polygonal or smooth outlines
    • Background, text, and grid colors
    • Custom fonts and title prefix
  • Command-line interface with flexible flags for customization

Example Output

UCL - Messi, CR7, Neymar Radar Chart

Setup and Installation

  1. Clone the repository
git clone https://github.com/your-username/fbref-comparison-radar.git
cd fbref-comparison-radar
  1. Create and activate a virtual environment (optional but recommended)
python3 -m venv venv
source venv/bin/activate  # For Linux/macOS
# .\venv\Scripts\activate  # For Windows CMD
# .\venv\Scripts\Activate.ps1  # For PowerShell
  1. Install dependencies
pip install -r requirements.txt
  1. Download HTML files manually from FBRef
  • Navigate to the Player Comparison tool on FBRef
  • Save the page as "Webpage, Complete"
  • Place the .html file in the htmls/ directory

Usage

Basic

python multi_player_radar.py scrk-ucl

With Specific Players

python multi_player_radar.py scrk-ucl \
    --players "Chiesa Federico" "Rashford Marcus"

Save Output with Custom Title

python multi_player_radar.py scrk-ucl --save \
    --title "Winger Comparison" --output-dir data_viz

Customize Appearance

python multi_player_radar.py scrk-ucl --polygonal --bgcolor "#2C2C2C" \
    --textcolor "#EDEDED" --circlecolor "gray"

View All Options

python multi_player_radar.py --help

Repository Structure

  • multi_player_radar.py — Main script
  • requirements.txt — Dependencies
  • README.md — Project documentation
  • htmls/ — Your downloaded FBRef HTML files
  • data_viz/ — Output images
  • examples/ — Example radar charts

Dependencies

  • Python 3.8+
  • beautifulsoup4>=4.9.0
  • numpy>=1.18.0
  • matplotlib>=3.3.0

Contributing

Contributions are welcome! Feel free to fork this repo and submit a pull request.


About

Generate customizable radar charts to compare football players using saved HTML data.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages