Skip to content

Releases: Sport-Performance-Lab/mplhockey

v1.0.2

Choose a tag to compare

@jefferybarrett jefferybarrett released this 17 Sep 17:11
562fe1b

What's Changed

Full Changelog: v1.0.1...v1.0.2

v1.0.1

Choose a tag to compare

@jefferybarrett jefferybarrett released this 14 Apr 01:48
7f34212

What's Changed

New Contributors

Full Changelog: v1.0.0...v1.0.1

v1.0.0

Choose a tag to compare

@jefferybarrett jefferybarrett released this 27 Jan 20:57

mplhockey 1.0.0 - Initial Release

Overview

mplhockey is a Python library for plotting hockey rink charts in Matplotlib. This lightweight, composable library is designed specifically for hockey analytics and visualization workflows, inspired by similar projects like mplsoccer and mplbasketball.

Core Features

League Support

The library provides rink geometries for six different leagues:

  • NHL - National Hockey League (200 ft × 85 ft)
  • NCAA - NCAA college hockey
  • IIHF - International Ice Hockey Federation
  • KHL - Kontinental Hockey League
  • PWHL - Professional Women's Hockey League (same dimensions as NHL)
  • NRL - National Ringette League

Flexible Unit System

  • Support for 40+ unit types including: m, ft, cm, in, yd, km, mi, mm, and many more
  • Units can be specified at rink instantiation or at draw time
  • All geometries scale correctly with unit conversions

Coordinate System

  • Right-handed Cartesian system centered at center ice
  • Origin (0, 0) at center ice
  • X-axis: along rink length
  • Y-axis: across rink width
  • Perfect for overlaying spatial data (shots, tracking data, model outputs)

Theme System

  • Four built-in themes: light, dark, over-dark, over-light
  • Customizable color schemes via dictionary override
  • Color scheme loaded from YAML with caching mechanism
  • Support for "none" color values for transparent elements

Rotation & Display Ranges

  • Arbitrary rotation capability (in degrees)
  • Pre-defined display ranges for specific zones:
    • Full rink view
    • Attacking zone (ozone)
    • Defensive zone (dzone)
    • Neutral zone (nzone)
    • Goal areas (ogoal/dgoal)
  • Useful for consistent attacking-direction visualizations

Rich Geometric Features

  • Nets, creases, boards, ice surface
  • Goal areas, trapezoid zones
  • Faceoff circles and markings
  • League-specific geometries
  • Feature mirroring (auto-symmetry for width/length)

Matplotlib Integration

  • Renders as standard Matplotlib artists
  • Compatible with scatter plots, lines, contours, heatmaps
  • Supports all Matplotlib export formats (PNG, SVG, PDF, etc.)
  • Custom axes control and styling

Extensible Design

  • Easy to add new leagues, historical dimensions, or custom surfaces
  • Feature-based architecture for modular rendering
  • YAML-based rink specifications

Technical Details

Compatibility

  • Python 3.9+
  • Explicit support for Python 3.13 and 3.14

Dependencies

  • matplotlib>=3.9.0,<4
  • shapely>=2.0.7,<3
  • numpy>=2.1.0 (py3.13+) or >=1.26.0 (py3.12-)
  • pyyaml>=6.0.3

Testing & Quality Assurance

  • Comprehensive test suite with pytest
  • Visual regression testing with pytest-mpl
  • Extensive baseline test images

CI/CD Pipeline

  • GitHub Actions workflow for automated testing
  • PyPI publishing pipeline

Design Philosophy

mplhockey is deliberately focused on geometry and rendering only:

  • Does NOT fetch or manage hockey data
  • Does NOT impose a data model for events/players
  • Does NOT replace general-purpose plotting libraries
  • Aims to be a robust, composable building block for analysis and visualization pipelines

License

MIT License (Copyright 2026 MLSE Ltd.)

Links

  • Repository: github.com/mlsedigital/mplhockey
  • Documentation: See README.md and docs/ directory