Skip to content

Instantly share code, notes, and snippets.

@garybake
Created November 25, 2019 14:00
Show Gist options
  • Save garybake/ef0fc07526315729ba8518a4c4bf9559 to your computer and use it in GitHub Desktop.
Save garybake/ef0fc07526315729ba8518a4c4bf9559 to your computer and use it in GitHub Desktop.
ECDF chart
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