Statistical Thinking in Python (Part 1)
Justin Bois
Teaching Professor at the California Institute of Technology
import numpy as np
x = np.sort(df_swing['dem_share'])
y = np.arange(1, len(x)+1) / len(x)
_ = plt.plot(x, y, marker='.', linestyle='none')
_ = plt.xlabel('percent of vote for Obama') _ = plt.ylabel('ECDF')
plt.margins(0.02) # Keeps data off plot edges plt.show()
Statistical Thinking in Python (Part 1)