This project uses the mplsoccer library to create a visual representation of a futsal pitch, which has several differences from a regular football pitch, including its dimensions of 40 by 20 meters. Additionally, futsal has its own markings, as outlined in the FIFA rules Futsal Laws of the Game.
The goal of this project is to provide a script that can use this futsal pitch in sports data analysis, utilizing event data. The project includes a Jupyter notebook that demonstrates how to use this pitch for visualizing match data and performing analysis.
This script defines a futsal
class to represent a futsal pitch and its tactical features using matplotlib
. The pitch can be drawn in both horizontal and vertical orientations and supports both full and half-pitch views. The code also includes adaptations needed for blind football.
_setup_ax
: Initializes the plotting axes._draw_pitch
: Handles the drawing of the pitch, including various features depending on the orientation (horizontal/vertical) and whether the full or half-pitch view is required.
- Outline: The outer boundary of the pitch is drawn as a rectangle.
- Center Circle: A circle at the center of the pitch.
- Penalty Spots: Circles representing the penalty spots on both sides of the pitch.
- Penalty Areas: Areas with arcs representing the penalty zones.
- Goals: Lines representing the goals on both sides of the pitch.
- Substitution Lines: Vertical lines indicating where substitutions can take place.
- Corners: Arcs drawn at each corner of the pitch.
- Orientation: The pitch can be drawn horizontally or vertically.
- Half-Pitch: Option to draw only half the pitch (left/right or upper/lower).
- Color: Option to change the background color of the pitch to blue and the lines to red for better visual clarity in blind football.
The data used for the visualization can be found here.
In this section, we visualize the attacks made by the two teams (ARG and CRC) during the match.
In this section, we present a pass map illustrating the passing patterns of the teams ARG and CRC during the match.
In this section, we present a heatmap of all events involving the Argentine team during the match.
Note: This script also includes a class for Blind Football based on this project. You can find the related code in this repository.