ECDF Plot

Commute Time ECDF

Light theme ECDF comparing commute methods

Output
Commute Time ECDF
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)
car = np.random.gamma(4, 8, 300)
public = np.random.gamma(5, 10, 300)
bike = np.random.gamma(3, 7, 300)

ax.ecdf(car, color='#3b82f6', linewidth=2.5, label='Car')
ax.ecdf(public, color='#22c55e', linewidth=2.5, label='Public Transit')
ax.ecdf(bike, color='#f97316', linewidth=2.5, label='Bike')

ax.set_xlabel('Commute Time (minutes)', fontsize=12, color='#1f2937')
ax.set_ylabel('Cumulative Probability', fontsize=12, color='#1f2937')
ax.set_title('Commute Time by Method', fontsize=16, fontweight='bold', color='#1f2937', pad=20)
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