Created
November 25, 2019 14:00
-
-
Save garybake/ef0fc07526315729ba8518a4c4bf9559 to your computer and use it in GitHub Desktop.
ECDF chart
This file contains hidden or 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 | |
def get_ecdf_chart(deltas, title=None): | |
def ecdf(data): | |
"""Compute ECDF. | |
Empirical Cumulative Distribution Function | |
""" | |
x = np.sort(data) | |
n = x.size | |
y = np.arange(1, n+1) / n | |
return(x,y) | |
x, y = ecdf(deltas) | |
fig, ax = plt.subplots(figsize=(3, 3)) | |
ax.plot(x, y) | |
ax.axhline(y=0.9, color='r', linestyle='-') | |
if title: | |
fig.suptitle(title, fontsize=12, x=0.1, y=1.0) | |
return fig |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment