ProfessorLeVesseur commited on
Commit
a17a72b
·
verified ·
1 Parent(s): 41ce9ac

Update visualization.py

Browse files
Files changed (1) hide show
  1. visualization.py +9 -3
visualization.py CHANGED
@@ -52,13 +52,19 @@ class Visualization:
52
  height = bar.get_height()
53
  ax.text(bar.get_x() + bar.get_width() / 2, height, f'{height:.0f}%', ha='center', va='bottom', color='black')
54
 
 
 
 
 
 
55
  ax.axhline(y=90, color='#005288', linestyle=':', linewidth=1.5, label=f'Attendance Threshold: ≥ 90%')
56
  ax.axhline(y=80, color='#3AB0FF', linestyle=':', linewidth=1.5, label=f'Engagement Threshold: ≥ 80%')
57
  ax.axhline(y=attendance_avg_stats, color='#005288', linestyle='--', linewidth=1.5, label=f'Attendance Average: {attendance_avg_stats}%')
58
  ax.axhline(y=engagement_avg_stats, color='#3AB0FF', linestyle='--', linewidth=1.5, label=f'Engagement Average: {engagement_avg_stats}%')
59
- ax.fill_between(x=np.linspace(ax.get_xlim() <sup> </sup>, ax.get_xlim()[1], 100, alpha=0.1, color='#005288', label='Attendance Goal')
60
- ax.fill_between(x=np.linspace(ax.get_xlim() <sup> </sup>, ax.get_xlim()[1], 89, alpha=0.1, color='#3AB0FF', label='Engagement Goal')
61
-
 
62
  ax.set_xlabel('Student')
63
  ax.set_ylabel('Percentage (%)')
64
  ax.set_title('Student Attendance and Engagement Metrics')
 
52
  height = bar.get_height()
53
  ax.text(bar.get_x() + bar.get_width() / 2, height, f'{height:.0f}%', ha='center', va='bottom', color='black')
54
 
55
+ # Highlight the range 80-89 for "Engagement Goal" and 90-100 for "Attendance Goal"
56
+ ax.fill_betweenx(y=[80, 89], x1=0, x2=1, color='#3AB0FF', alpha=0.2, label='Engagement Goal')
57
+ ax.fill_betweenx(y=[90, 100], x1=0, x2=1, color='#005288', alpha=0.2, label='Attendance Goal')
58
+
59
+ # Add horizontal lines for thresholds and averages
60
  ax.axhline(y=90, color='#005288', linestyle=':', linewidth=1.5, label=f'Attendance Threshold: ≥ 90%')
61
  ax.axhline(y=80, color='#3AB0FF', linestyle=':', linewidth=1.5, label=f'Engagement Threshold: ≥ 80%')
62
  ax.axhline(y=attendance_avg_stats, color='#005288', linestyle='--', linewidth=1.5, label=f'Attendance Average: {attendance_avg_stats}%')
63
  ax.axhline(y=engagement_avg_stats, color='#3AB0FF', linestyle='--', linewidth=1.5, label=f'Engagement Average: {engagement_avg_stats}%')
64
+
65
+ # Set the x-limits to ensure the fill covers the entire plot width
66
+ ax.set_xlim(left=0, right=1)
67
+
68
  ax.set_xlabel('Student')
69
  ax.set_ylabel('Percentage (%)')
70
  ax.set_title('Student Attendance and Engagement Metrics')