ECDF Plot

Test Scores ECDF

Dark theme showing student test score distribution

Output
Test Scores ECDF
Python
import matplotlib.pyplot as plt
import numpy as np

fig, ax = plt.subplots(figsize=(10, 6), facecolor='#0a0a0f')
ax.set_facecolor('#0a0a0f')

np.random.seed(42)
scores = np.clip(np.random.normal(72, 15, 500), 0, 100)

ax.ecdf(scores, color='#f472b6', linewidth=2.5)

passing = 60
ax.axvline(x=passing, color='#fbbf24', linestyle='--', linewidth=2, label=f'Passing: {passing}')
pass_rate = np.mean(scores >= passing)
ax.axhline(y=1-pass_rate, color='#fbbf24', linestyle='--', linewidth=2, alpha=0.5)

ax.set_xlabel('Test Score', fontsize=12, color='white')
ax.set_ylabel('Cumulative Probability', fontsize=12, color='white')
ax.set_title('Test Score Distribution', fontsize=16, fontweight='bold', color='white', pad=20)
ax.tick_params(colors='white')
ax.set_xlim(0, 100)
ax.legend(facecolor='#1a1a2f', edgecolor='#333', labelcolor='white')
ax.grid(True, alpha=0.2, color='white')

for spine in ax.spines.values():
    spine.set_color('#333')

plt.tight_layout()
Library

Matplotlib

Category

Statistical

Did this help you?

Support PyLucid to keep it free & growing

Support