ECDF Plot

Product Rating ECDF

Dark theme ECDF showing product rating distribution

Output
Product Rating 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)
ratings = np.clip(np.random.normal(4.2, 0.8, 500), 1, 5)

ax.ecdf(ratings, color='#fbbf24', linewidth=2.5)

ax.axvline(x=4.0, color='#22c55e', linestyle='--', linewidth=2, label='Good (4.0+)')
ax.axvline(x=3.0, color='#ef4444', linestyle='--', linewidth=2, label='Poor (<3.0)')

ax.set_xlabel('Rating (1-5 stars)', fontsize=12, color='white')
ax.set_ylabel('Cumulative Probability', fontsize=12, color='white')
ax.set_title('Product Rating ECDF', fontsize=16, fontweight='bold', color='white', pad=20)
ax.tick_params(colors='white')
ax.set_xlim(1, 5)
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