ECDF Plot

Customer Lifetime Value

Light theme ECDF showing CLV distribution

Output
Customer Lifetime Value
Python
import matplotlib.pyplot as plt
import numpy as np

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

np.random.seed(42)
clv = np.random.lognormal(5.5, 1.2, 600)

ax.ecdf(clv, color='#059669', linewidth=2.5)

median_clv = np.median(clv)
ax.axvline(x=median_clv, color='#7c3aed', linestyle='--', linewidth=2, label=f'Median: ${median_clv:.0f}')

ax.set_xlabel('Customer Lifetime Value ($)', fontsize=12, color='#1f2937')
ax.set_ylabel('Cumulative Probability', fontsize=12, color='#1f2937')
ax.set_title('Customer Lifetime Value ECDF', fontsize=16, fontweight='bold', color='#1f2937', pad=20)
ax.set_xlim(0, np.percentile(clv, 98))
ax.legend(loc='lower right')
ax.grid(True, alpha=0.3)

for spine in ['top', 'right']:
    ax.spines[spine].set_visible(False)

plt.tight_layout()
Library

Matplotlib

Category

Statistical

Did this help you?

Support PyLucid to keep it free & growing

Support