ECDF Plot

Battery Life ECDF

Dark theme ECDF for device battery duration

Output
Battery Life 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)
battery_hours = np.random.normal(8, 1.5, 500)

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

spec = 6
pct_meeting_spec = np.mean(battery_hours >= spec) * 100
ax.axvline(x=spec, color='#22c55e', linestyle='--', linewidth=2, 
           label=f'Spec: {spec}h ({pct_meeting_spec:.1f}% pass)')

ax.set_xlabel('Battery Life (hours)', fontsize=12, color='white')
ax.set_ylabel('Cumulative Probability', fontsize=12, color='white')
ax.set_title('Device Battery Life ECDF', fontsize=16, fontweight='bold', color='white', pad=20)
ax.tick_params(colors='white')
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