Created
March 24, 2016 05:50
-
-
Save mtrbean/b571718c91dbb1c313dc to your computer and use it in GitHub Desktop.
CDF Plot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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