1import numpy as np
2from pylab import *
3
4# Create some test data
5dx = 0.01
6X = np.arange(-2, 2, dx)
7Y = exp(-X ** 2)
8
9# Normalize the data to a proper PDF
10Y /= (dx * Y).sum()
11
12# Compute the CDF
13CY = np.cumsum(Y * dx)
14
15# Plot both
16plot(X, Y)
17plot(X, CY, 'r--')
18
19show()