英雄联盟回放播放终极解决方案:ROFL-Player完全使用指南
2026/7/1 10:31:20
下面模拟一个学生考试成绩分布的分析场景,看看上面两种点状图的应用。
# 示例:学生考试成绩分布分析 print("示例:学生考试成绩分布分析") print("-" * 40) # 创建模拟的考试成绩数据 np.random.seed(42) exam_scores = np.concatenate( [ np.random.normal(65, 8, 45), # 中等水平学生 np.random.normal(85, 6, 30), # 优秀学生 np.random.normal(45, 10, 24), # 需要帮助的学生 ] ) # 过滤掉不合理分数 exam_scores = np.clip(exam_scores, 0, 100) print(f"学生总数: {len(exam_scores)}") print(f"分数范围: {exam_scores.min():.1f} - {exam_scores.max():.1f}") print(f"平均分: {exam_scores.mean():.1f}") print(f"及格率: {(exam_scores >= 60).sum() / len(exam_scores) * 100:.1f}%\n") # 使用威尔金森点状图 print("创建威尔金森点状图...") fig1, ax1, stats1 = wilkinson_dot_plot( exam_scores, bins=[0, 40, 60, 70, 80, 90, 100], ) plt.show() # 使用麦穗图 print("创建麦穗图...") fig2, ax2, stats2 = strip_plot( exam_scores, bins=[0, 40, 60, 70, 80, 90, 100], jitter_amount=0.15, ) plt.show() ## 输出结果: ''' 示例:学生考试成绩分布分析 ---------------------------------------- 学生总数: 99 分数范围: 25.1 - 94.4 平均分: 65.3 及格率: 63.6% '''在学生考试成绩分析这个场景中:
总的来说,威尔金森点状图看分布形态(区间视角),麦穗图看具体数值(精确视角)。