""" Fig 15: User Guide Radar Chart Compares different usage modes across multiple dimensions """ import os import numpy as np import matplotlib.pyplot as plt from plot_style import set_oprice_style, save_figure def make_figure(config): """Generate Fig 15: User Guide Radar Chart""" set_oprice_style() # Define categories (dimensions) categories = ['Battery Life', 'Performance', 'Display Quality', 'Connectivity', 'User Experience'] n_cats = len(categories) # Define two usage modes # Values are normalized scores (0-5 scale) power_saver = [4.5, 2.0, 2.5, 2.0, 2.5] # Optimized for battery high_performance = [1.5, 5.0, 5.0, 4.5, 4.0] # Optimized for experience # Add first value to end to close the polygon power_saver += power_saver[:1] high_performance += high_performance[:1] # Compute angle for each axis angles = np.linspace(0, 2 * np.pi, n_cats, endpoint=False).tolist() angles += angles[:1] # Create figure fig, ax = plt.subplots(figsize=(10, 10), subplot_kw=dict(projection='polar')) # Plot data ax.plot(angles, power_saver, 'o-', linewidth=2.5, label='Power Saver Mode', color='#2ca02c', markersize=8) ax.fill(angles, power_saver, alpha=0.25, color='#2ca02c') ax.plot(angles, high_performance, 's-', linewidth=2.5, label='High Performance Mode', color='#d62728', markersize=8) ax.fill(angles, high_performance, alpha=0.25, color='#d62728') # Fix axis to go in the right order and start at 12 o'clock ax.set_theta_offset(np.pi / 2) ax.set_theta_direction(-1) # Draw axis lines for each angle and label ax.set_xticks(angles[:-1]) ax.set_xticklabels(categories, fontsize=11) # Set y-axis limits and labels ax.set_ylim(0, 5) ax.set_yticks([1, 2, 3, 4, 5]) ax.set_yticklabels(['1', '2', '3', '4', '5'], fontsize=9) ax.set_rlabel_position(180 / n_cats) # Add grid ax.grid(True, linewidth=0.5, alpha=0.5) # Title and legend ax.set_title('Usage Mode Comparison: Multi-Dimensional Trade-offs', fontsize=12, fontweight='bold', pad=20) ax.legend(loc='upper right', bbox_to_anchor=(1.3, 1.1), framealpha=0.9, fontsize=10) # Add recommendations text box recommendations = [ 'Recommendations:', '', 'Power Saver Mode:', '• Reduce screen brightness', '• Limit background apps', '• Disable GPS when not needed', '• Use Wi-Fi over cellular', '→ Extends battery life by ~80%', '', 'High Performance Mode:', '• Max brightness for outdoor', '• Enable all connectivity', '• No CPU throttling', '→ Best user experience', '', 'Balanced (Recommended):', '• Adaptive brightness', '• GPS on-demand only', '• Background limits', '→ Optimal trade-off' ] # Add text box outside the radar plot fig.text(0.02, 0.98, '\\n'.join(recommendations), fontsize=9, verticalalignment='top', bbox=dict(boxstyle='round', facecolor='wheat', alpha=0.8), family='monospace') # Add specific recommendations for GPS gps_note = 'GPS Impact:\n' + \ '• Continuous GPS: -15% TTE\n' + \ '• Navigation mode: -20% TTE\n' + \ '• Best practice: Enable only\n' + \ ' when actively navigating' fig.text(0.02, 0.50, gps_note, fontsize=9, verticalalignment='top', bbox=dict(boxstyle='round', facecolor='lightgreen', alpha=0.8)) plt.tight_layout() # Save figure_dir = config.get('global', {}).get('figure_dir', 'figures') os.makedirs(figure_dir, exist_ok=True) output_base = os.path.join(figure_dir, 'Fig15_Radar_User_Guide') save_figure(fig, output_base, dpi=config.get('global', {}).get('dpi', 300)) plt.close() # Compute aggregate scores power_saver_avg = np.mean(power_saver[:-1]) high_perf_avg = np.mean(high_performance[:-1]) return { "output_files": [f"{output_base}.pdf", f"{output_base}.png"], "computed_metrics": { "power_saver_score": float(power_saver_avg), "high_performance_score": float(high_perf_avg), "battery_life_advantage": float(power_saver[0] - high_performance[0]) }, "validation_flags": {}, "pass": True }