Skip to main content

Package to allow creation of football pitch charts using plotly

Project description

plotly-football-pitch

tests

This repo contains code to plot football pitches using plotly. Currently only horizontal pitches are supported, with the origin located at the bottom left corner of the pitch.

Examples

Further examples can be found in examples/pitch.ipynb.

from plotly_football_pitch import make_pitch_figure, PitchDimensions


dimensions = PitchDimensions()
fig = make_pitch_figure(dimensions)
fig.show()

basic pitch

from plotly_football_pitch import (
    make_pitch_figure,
    PitchDimensions,
    SingleColourBackground
)


dimensions = PitchDimensions()
fig = make_pitch_figure(
    dimensions,
    pitch_background=SingleColourBackground("#81B622"),
)
fig.show()

green pitch

import numpy as np

from plotly_football_pitch import make_pitch_figure, PitchDimensions


dimensions = PitchDimensions()
fig = make_pitch_figure(dimensions)

# define number of grid squares for heatmap data
width_grid = 12
length_grid = 15

data = np.array([
    [random.random() for _ in range(length_grid)]
    for _ in range(width_grid)
])

fig = add_heatmap(fig, data)
fig.show()

basic pitch with heatmap

Installation

pip install plotly_football_pitch

Development installation

make setup-env
source .venv/bin/activate
make dev-install

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

plotly_football_pitch-0.0.3.tar.gz (11.3 kB view details)

Uploaded Source

Built Distribution

plotly_football_pitch-0.0.3-py3-none-any.whl (10.7 kB view details)

Uploaded Python 3

File details

Details for the file plotly_football_pitch-0.0.3.tar.gz.

File metadata

  • Download URL: plotly_football_pitch-0.0.3.tar.gz
  • Upload date:
  • Size: 11.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.2

File hashes

Hashes for plotly_football_pitch-0.0.3.tar.gz
Algorithm Hash digest
SHA256 454f79cb08f7da5ecb1034eb9dc8e00d37c8f0d8820a0ef27c0004c94855ad03
MD5 2fe4f5b9deddfebf9015514422a1d68c
BLAKE2b-256 5d144958ee336972af2e8b9dd93650980c58b3e8030071da0ab588472d97a403

See more details on using hashes here.

File details

Details for the file plotly_football_pitch-0.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for plotly_football_pitch-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 9b1d85a93d244daeeee1e6fe865777086c7a0b98da6e5dd3819ff46a1c5dd9e6
MD5 74255125c34746a6b7f8ec012ed0ca04
BLAKE2b-256 10f8786d05698f578ec890e0fbf082b43ae8020b649e237975165f1e1abbe803

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page