Skip to content

Commit

Permalink
added plot functions to usage
Browse files Browse the repository at this point in the history
  • Loading branch information
RobBlumberg committed Mar 28, 2020
1 parent 1a6c1bc commit 570d2c4
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ This is a package to get statsbomb public data into python. Statsbomb themselves
- numpy 1.18.2
- matplotlib 3.2.1

### Installation:
### Installation

The package has been deployed to test pypi. If you do not have the dependencies listed above installed, please use the command below.
```
Expand Down Expand Up @@ -90,6 +90,16 @@ Earlier, I showed it was possible to get the shots for a game using the Game obj

A similar thing can be done with the `get_shots_for_league` function to get all shots for a league by passing in the league's dictionary of dictionaries, like `wc_data` from the earlier example.

There are also functions to visualize a shot and the opponents around the shot when it was taken. This is done using the `draw_pitch` and `plot_shot_freeze_frame` functions. We just need to pass in a `Game` object whose `get_shots_for_game` method has been called, and a shot id for that game.
```python
import matplotlib.pyplot as plt
fig, ax = plt.subplots(1, 1, figsize=(15, 10))
sbd.draw_pitch(ax, rotate=True)
sbd.plot_shot_freeze_frame(game,"6b09b997-06b0-43e7-a47f-13fddf502adc", axis=ax)
plt.show()
```
![](img/shot_plot_example.png)

### Documentation
The official documentation is hosted on Read the Docs: <https://sbdataextraction.readthedocs.io/en/latest/>

Expand Down

0 comments on commit 570d2c4

Please sign in to comment.