Spaces:
Running
Running
Upload pitch_summary_functions.py
Browse files
pitch_summary_functions.py
CHANGED
@@ -301,6 +301,7 @@ def df_clean(df):
|
|
301 |
### PITCH COLOURS ###
|
302 |
pitch_colours = {
|
303 |
'Four-Seam Fastball':'#FF007D',#BC136F
|
|
|
304 |
'Sinker':'#98165D',#DC267F
|
305 |
'Cutter':'#BE5FA0',
|
306 |
|
@@ -318,7 +319,7 @@ pitch_colours = {
|
|
318 |
'Slow Curve':'#274BFC',
|
319 |
'Eephus':'#648FFF',
|
320 |
|
321 |
-
'
|
322 |
|
323 |
'Pitch Out':'#472C30',
|
324 |
'Other':'#9C8975',
|
@@ -843,10 +844,10 @@ def table_summary(df,
|
|
843 |
table.get_celld()[(i+1,16)].set_facecolor(get_color(float(table.get_celld()[(i+1, 16)].get_text().get_text().strip('%')),normalize,cmap_sum)) # Header cell color
|
844 |
print("LOOK HERE")
|
845 |
print(select_df)
|
846 |
-
|
847 |
normalize = mcolors.Normalize(vmin=select_df['xwobacon'].mean()*0.7, vmax=select_df['xwobacon'].mean()*1.3)
|
848 |
if table.get_celld()[(i+1,17)].get_text().get_text() != '—':
|
849 |
-
table.get_celld()[(i+1,17)].set_facecolor(get_color(float(table.get_celld()[(i+1, 17)].get_text().get_text().strip('%')),normalize,
|
850 |
|
851 |
|
852 |
|
|
|
301 |
### PITCH COLOURS ###
|
302 |
pitch_colours = {
|
303 |
'Four-Seam Fastball':'#FF007D',#BC136F
|
304 |
+
'Fastball':'#FF007D',
|
305 |
'Sinker':'#98165D',#DC267F
|
306 |
'Cutter':'#BE5FA0',
|
307 |
|
|
|
319 |
'Slow Curve':'#274BFC',
|
320 |
'Eephus':'#648FFF',
|
321 |
|
322 |
+
'Knuckle Ball':'#867A08',
|
323 |
|
324 |
'Pitch Out':'#472C30',
|
325 |
'Other':'#9C8975',
|
|
|
844 |
table.get_celld()[(i+1,16)].set_facecolor(get_color(float(table.get_celld()[(i+1, 16)].get_text().get_text().strip('%')),normalize,cmap_sum)) # Header cell color
|
845 |
print("LOOK HERE")
|
846 |
print(select_df)
|
847 |
+
cmap_sum_r = matplotlib.colors.LinearSegmentedColormap.from_list("", ['#FFB000','#FFFFFF','#648FFF',])
|
848 |
normalize = mcolors.Normalize(vmin=select_df['xwobacon'].mean()*0.7, vmax=select_df['xwobacon'].mean()*1.3)
|
849 |
if table.get_celld()[(i+1,17)].get_text().get_text() != '—':
|
850 |
+
table.get_celld()[(i+1,17)].set_facecolor(get_color(float(table.get_celld()[(i+1, 17)].get_text().get_text().strip('%')),normalize,cmap_sum_r)) # Header cell color
|
851 |
|
852 |
|
853 |
|