de-Rodrigo commited on
Commit
f3b063f
·
1 Parent(s): 08ad32f

White Background T-SNE Plot

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -1547,9 +1547,10 @@ def run_model(model_name):
1547
  df_heatmap['x'], df_heatmap['y'], df_heatmap[selected_feature],
1548
  statistic='mean', bins=[x_bins, y_bins]
1549
  )
1550
- # heatmap_data = heat_stat.T
1551
- heatmap_data = np.nan_to_num(heat_stat.T, nan=0.0, posinf=0.0, neginf=0.0)
1552
-
 
1553
  cmap = plt.get_cmap("RdYlGn")
1554
  red_green_palette = [mcolors.rgb2hex(cmap(i)) for i in np.linspace(0, 1, 256)]
1555
 
@@ -1559,17 +1560,16 @@ def run_model(model_name):
1559
  palette=red_green_palette,
1560
  low=0,
1561
  high=1,
1562
- nan_color='rgba(0, 0, 0, 0)'
1563
  )
1564
  else:
1565
  color_mapper = LinearColorMapper(
1566
  palette="Viridis256",
1567
  low=np.nanmin(heatmap_data),
1568
  high=np.nanmax(heatmap_data),
1569
- nan_color='rgba(0, 0, 0, 0)'
1570
  )
1571
 
1572
-
1573
 
1574
  # Figura heatmap
1575
  heatmap_fig = figure(title=f"Heatmap de '{selected_feature}' ({x_comp} vs {y_comp})",
 
1547
  df_heatmap['x'], df_heatmap['y'], df_heatmap[selected_feature],
1548
  statistic='mean', bins=[x_bins, y_bins]
1549
  )
1550
+
1551
+ # Mantener NaN para celdas vacías
1552
+ heatmap_data = heat_stat.T
1553
+
1554
  cmap = plt.get_cmap("RdYlGn")
1555
  red_green_palette = [mcolors.rgb2hex(cmap(i)) for i in np.linspace(0, 1, 256)]
1556
 
 
1560
  palette=red_green_palette,
1561
  low=0,
1562
  high=1,
1563
+ nan_color="white"
1564
  )
1565
  else:
1566
  color_mapper = LinearColorMapper(
1567
  palette="Viridis256",
1568
  low=np.nanmin(heatmap_data),
1569
  high=np.nanmax(heatmap_data),
1570
+ nan_color="white"
1571
  )
1572
 
 
1573
 
1574
  # Figura heatmap
1575
  heatmap_fig = figure(title=f"Heatmap de '{selected_feature}' ({x_comp} vs {y_comp})",