How to plot cdf in matplotlib in Python?

I know I’m late to the party. But, there is a simpler way if you just want the cdf for your plot and not for future calculations:

plt.hist(put_data_here, normed=True, cumulative=True, label="CDF",
         histtype="step", alpha=0.8, color="k")

As an example,

plt.hist(dataset, bins=bins, normed=True, cumulative=True, label="CDF DATA", 
         histtype="step", alpha=0.55, color="purple")
# bins and (lognormal / normal) datasets are pre-defined

EDIT: This example from the matplotlib docs may be more helpful.

Leave a Comment

techhipbettruvabetnorabahisbahis forumueduseduseduseduseduedueduedusedusedu