cumulative distribution plots python

PHOTO EMBED

Tue Jun 28 2022 08:20:26 GMT+0000 (Coordinated Universal Time)

Saved by @lahiruaruna #python

import numpy as np
import matplotlib.pyplot as plt

# some fake data
data = np.random.randn(1000)
# evaluate the histogram
values, base = np.histogram(data, bins=40)
#evaluate the cumulative
cumulative = np.cumsum(values)
# plot the cumulative function
plt.plot(base[:-1], cumulative, c='blue')
#plot the survival function
plt.plot(base[:-1], len(data)-cumulative, c='green')

plt.show()
content_copyCOPY

https://stackoverflow.com/questions/15408371/cumulative-distribution-plots-python