Skip to content

Instantly share code, notes, and snippets.

@mtrbean
Created March 24, 2016 05:50
Show Gist options
  • Save mtrbean/b571718c91dbb1c313dc to your computer and use it in GitHub Desktop.
Save mtrbean/b571718c91dbb1c313dc to your computer and use it in GitHub Desktop.
CDF Plot
import numpy as np
from pylab import plot
def cdfplot(data=None, show_plot=True):
n_bins = len(unique(data))
counts, bin_edges = np.histogram(data, n_bins, normed=True)
ecdf = np.cumsum(counts)
ecdf = ecdf/ecdf.max()
if show_plot:
plot(bin_edges[1:],ecdf)
return bin_edges, ecdf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment