Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions examples/pressing_intensity.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,13 @@
"# %pip install unravelsports --quiet"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"You might need to `pip install ffmpeg mplsoccer matplotlib seaborn` for this to work."
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down Expand Up @@ -508,9 +515,7 @@
"source": [
"**Video**\n",
"\n",
"Finally, we render our 35 second video using `FuncAnimation` and `mplsoccer`.\n",
"\n",
"You might need to `pip install ffmpeg` for this to work."
"Finally, we render our 35 second video using `FuncAnimation` and `mplsoccer`."
]
},
{
Expand Down
4 changes: 0 additions & 4 deletions unravel/soccer/models/pressing_intensity.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@
Constant,
)

from mplsoccer import VerticalPitch, Pitch
from matplotlib.axes import Axes
from matplotlib.figure import Figure

from .utils import time_to_intercept, probability_to_intercept


Expand Down
27 changes: 23 additions & 4 deletions unravel/utils/display/colors.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@

import re

from matplotlib.colors import LinearSegmentedColormap


@dataclass
class Color:
Expand Down Expand Up @@ -72,5 +70,26 @@ class GameColors:

@dataclass
class ColorMaps:
YELLOW_RED = LinearSegmentedColormap.from_list("", YlRd)
YELLOW_RED_R = LinearSegmentedColormap.from_list("", list(reversed(YlRd)))
_YlRd = ["#FFFF00", "#FF0000"] # Replace with actual YlRd values

@property
def YELLOW_RED(self):
try:
from matplotlib.colors import LinearSegmentedColormap

return LinearSegmentedColormap.from_list("", self._YlRd)
except ImportError:
raise ImportError(
"Seems like you don't have matplotlib installed. Please install it using: pip install matplotlib"
)

@property
def YELLOW_RED_R(self):
try:
from matplotlib.colors import LinearSegmentedColormap

return LinearSegmentedColormap.from_list("", list(reversed(self._YlRd)))
except ImportError:
raise ImportError(
"Seems like you don't have matplotlib installed. Please install it using: pip install matplotlib"
)