File tree Expand file tree Collapse file tree 3 files changed +31
-11
lines changed
Expand file tree Collapse file tree 3 files changed +31
-11
lines changed Original file line number Diff line number Diff line change 8989 " # %pip install unravelsports --quiet"
9090 ]
9191 },
92+ {
93+ "cell_type" : " markdown" ,
94+ "metadata" : {},
95+ "source" : [
96+ " You might need to `pip install ffmpeg mplsoccer matplotlib seaborn` for this to work."
97+ ]
98+ },
9299 {
93100 "cell_type" : " markdown" ,
94101 "metadata" : {},
508515 "source" : [
509516 " **Video**\n " ,
510517 " \n " ,
511- " Finally, we render our 35 second video using `FuncAnimation` and `mplsoccer`.\n " ,
512- " \n " ,
513- " You might need to `pip install ffmpeg` for this to work."
518+ " Finally, we render our 35 second video using `FuncAnimation` and `mplsoccer`."
514519 ]
515520 },
516521 {
Original file line number Diff line number Diff line change 1313 Constant ,
1414)
1515
16- from mplsoccer import VerticalPitch , Pitch
17- from matplotlib .axes import Axes
18- from matplotlib .figure import Figure
19-
2016from .utils import time_to_intercept , probability_to_intercept
2117
2218
Original file line number Diff line number Diff line change 33
44import re
55
6- from matplotlib .colors import LinearSegmentedColormap
7-
86
97@dataclass
108class Color :
@@ -72,5 +70,26 @@ class GameColors:
7270
7371@dataclass
7472class ColorMaps :
75- YELLOW_RED = LinearSegmentedColormap .from_list ("" , YlRd )
76- YELLOW_RED_R = LinearSegmentedColormap .from_list ("" , list (reversed (YlRd )))
73+ _YlRd = ["#FFFF00" , "#FF0000" ] # Replace with actual YlRd values
74+
75+ @property
76+ def YELLOW_RED (self ):
77+ try :
78+ from matplotlib .colors import LinearSegmentedColormap
79+
80+ return LinearSegmentedColormap .from_list ("" , self ._YlRd )
81+ except ImportError :
82+ raise ImportError (
83+ "Seems like you don't have matplotlib installed. Please install it using: pip install matplotlib"
84+ )
85+
86+ @property
87+ def YELLOW_RED_R (self ):
88+ try :
89+ from matplotlib .colors import LinearSegmentedColormap
90+
91+ return LinearSegmentedColormap .from_list ("" , list (reversed (self ._YlRd )))
92+ except ImportError :
93+ raise ImportError (
94+ "Seems like you don't have matplotlib installed. Please install it using: pip install matplotlib"
95+ )
You can’t perform that action at this time.
0 commit comments