ECDF Plot
Churn Probability ECDF
Light theme ECDF showing customer churn prediction scores
Output
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)
churn_prob = np.random.beta(1.5, 5, 800)
ax.ecdf(churn_prob, color='#dc2626', linewidth=2.5)
high_risk = 0.5
ax.axvline(x=high_risk, color='#7c3aed', linestyle='--', linewidth=2,
label=f'High risk (>{high_risk*100:.0f}%)')
pct_high = np.mean(churn_prob > high_risk) * 100
ax.text(high_risk + 0.05, 0.5, f'{pct_high:.1f}% at risk', fontsize=10, color='#7c3aed')
ax.set_xlabel('Churn Probability', fontsize=12, color='#1f2937')
ax.set_ylabel('Cumulative Probability', fontsize=12, color='#1f2937')
ax.set_title('Customer Churn Probability ECDF', fontsize=16, fontweight='bold', color='#1f2937', pad=20)
ax.set_xlim(0, 1)
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
More ECDF Plot examples
☕