ECDF Plot

Order Value ECDF

Dark theme ECDF showing e-commerce order values

Output
Order Value 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)
order_value = np.random.lognormal(4, 0.8, 1000)

ax.ecdf(order_value, color='#22c55e', linewidth=2.5)

median = np.median(order_value)
mean = np.mean(order_value)
ax.axvline(x=median, color='#fbbf24', linestyle='--', linewidth=2, label=f'Median: ${median:.0f}')
ax.axvline(x=mean, color='#f472b6', linestyle='--', linewidth=2, label=f'Mean: ${mean:.0f}')

ax.set_xlabel('Order Value ($)', fontsize=12, color='white')
ax.set_ylabel('Cumulative Probability', fontsize=12, color='white')
ax.set_title('E-commerce Order Value ECDF', fontsize=16, fontweight='bold', color='white', pad=20)
ax.tick_params(colors='white')
ax.set_xlim(0, np.percentile(order_value, 98))
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