Update app.py
Browse files
app.py
CHANGED
@@ -422,9 +422,13 @@ def server(input, output, session):
|
|
422 |
def get_color(value,normalize):
|
423 |
color = cmap_sum(normalize(value))
|
424 |
return mcolors.to_hex(color)
|
425 |
-
|
426 |
-
|
427 |
-
vmax=table_left['pitch_percent']*1.5
|
|
|
|
|
|
|
|
|
428 |
|
429 |
|
430 |
|
@@ -467,9 +471,15 @@ def server(input, output, session):
|
|
467 |
'bip',
|
468 |
'xwoba_percent_contact'
|
469 |
]]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
470 |
|
471 |
-
normalize = mcolors.Normalize(vmin=table_right['pitch_percent']*0.5,
|
472 |
-
vmax=table_right['pitch_percent']*1.5+0.00001) # Define the range of values
|
473 |
|
474 |
|
475 |
df_colour_right = pd.DataFrame(data=[[get_color(x,normalize) for x in pivot_table_r.loc[0]],
|
|
|
422 |
def get_color(value,normalize):
|
423 |
color = cmap_sum(normalize(value))
|
424 |
return mcolors.to_hex(color)
|
425 |
+
try:
|
426 |
+
normalize = mcolors.Normalize(vmin=table_left['pitch_percent']*0.5,
|
427 |
+
vmax=table_left['pitch_percent']*1.5) # Define the range of values
|
428 |
+
|
429 |
+
except ValueError:
|
430 |
+
normalize = mcolors.Normalize(vmin=0,
|
431 |
+
vmax=1) # Define the range of values
|
432 |
|
433 |
|
434 |
|
|
|
471 |
'bip',
|
472 |
'xwoba_percent_contact'
|
473 |
]]
|
474 |
+
try:
|
475 |
+
normalize = mcolors.Normalize(vmin=table_right['pitch_percent']*0.5,
|
476 |
+
vmax=table_right['pitch_percent']*1.5) # Define the range of values
|
477 |
+
|
478 |
+
except ValueError:
|
479 |
+
normalize = mcolors.Normalize(vmin=0,
|
480 |
+
vmax=1) # Define the range of values
|
481 |
+
|
482 |
|
|
|
|
|
483 |
|
484 |
|
485 |
df_colour_right = pd.DataFrame(data=[[get_color(x,normalize) for x in pivot_table_r.loc[0]],
|