fortuala commited on
Commit
3e9b903
·
verified ·
1 Parent(s): de1b04b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -14
app.py CHANGED
@@ -18,35 +18,35 @@ scenario_map = {"0": "No cleansing", "A": "Urgent cleansing", "B": "Urgent+Low u
18
  # --- Traffic light plotting utility ---
19
  def plot_dimension(dim_col, scenario):
20
  value = data.set_index("scenario").loc[scenario, dim_col]
21
- fig, ax = plt.subplots(figsize=(3, 6)) # MUCH taller!
22
- # Traffic light backgrounds (now horizontal, for vertical bar)
23
  ax.axhspan(0, 0.6, color="#FF4D4F", alpha=0.35)
24
  ax.axhspan(0.6, 0.8, color="#FFE58F", alpha=0.35)
25
- ax.axhspan(0.8, 1, color="#52C41A", alpha=0.35)
26
- # Value marker (black horizontal line)
27
- ax.axhline(value, color='black', lw=6, xmin=0.20, xmax=0.80)
28
- # Value text, bold, big, just right of line
29
- ax.text(0.5, value, f"{value:.3f}", ha='center', va='bottom', fontsize=22, color='black', weight='bold')
30
- # Make it look like a traffic light by hiding x-axis and thick y-axis ticks
31
  ax.set_xlim(0, 1)
32
- ax.set_ylim(0, 1)
33
  ax.set_xticks([])
34
- ax.set_yticks([0, 0.6, 0.8, 1])
35
- ax.set_yticklabels(["0.0", "0.6", "0.8", "1.0"], fontsize=16)
36
- # Only left spine visible, thicker
37
  for spine in ax.spines.values():
38
  spine.set_visible(False)
39
  ax.spines['left'].set_visible(True)
40
  ax.spines['left'].set_linewidth(2)
41
- # Title, bold, multiline
42
  ax.set_title(
43
  f"{dim_col.replace('_', ' ').title()}\n({scenario_map[scenario]})",
44
- fontsize=15, weight='bold', pad=20
45
  )
46
  plt.tight_layout()
47
  return fig
48
 
49
 
 
50
  # --- Scenario selector callback ---
51
  def show_plots(scenario):
52
  fig1 = plot_dimension("consistency_score", scenario)
 
18
  # --- Traffic light plotting utility ---
19
  def plot_dimension(dim_col, scenario):
20
  value = data.set_index("scenario").loc[scenario, dim_col]
21
+ fig, ax = plt.subplots(figsize=(3, 6))
22
+ # Traffic light backgrounds
23
  ax.axhspan(0, 0.6, color="#FF4D4F", alpha=0.35)
24
  ax.axhspan(0.6, 0.8, color="#FFE58F", alpha=0.35)
25
+ ax.axhspan(0.8, 0.95, color="#52C41A", alpha=0.35) # Now top at 0.95
26
+ # Value marker (smaller, thinner)
27
+ ax.axhline(value, color='black', lw=2, xmin=0.35, xmax=0.65)
28
+ # Value text
29
+ ax.text(0.5, value, f"{value:.3f}", ha='center', va='bottom', fontsize=19, color='black', weight='bold')
30
+ # Styling
31
  ax.set_xlim(0, 1)
32
+ ax.set_ylim(0, 0.95)
33
  ax.set_xticks([])
34
+ ax.set_yticks([0, 0.6, 0.8, 0.95])
35
+ ax.set_yticklabels(["0.0", "0.6", "0.8", "1.0"], fontsize=14)
 
36
  for spine in ax.spines.values():
37
  spine.set_visible(False)
38
  ax.spines['left'].set_visible(True)
39
  ax.spines['left'].set_linewidth(2)
40
+ # Title with smaller padding
41
  ax.set_title(
42
  f"{dim_col.replace('_', ' ').title()}\n({scenario_map[scenario]})",
43
+ fontsize=14, weight='bold', pad=6
44
  )
45
  plt.tight_layout()
46
  return fig
47
 
48
 
49
+
50
  # --- Scenario selector callback ---
51
  def show_plots(scenario):
52
  fig1 = plot_dimension("consistency_score", scenario)