I'm able to plot a CDF plot (My CDF) using
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
from matplotlib.ticker import FuncFormatter
def to_percent(y, position):
# Ignore the passed in position. This has the effect of scaling the default
# tick locations.
s = str(y)
# The percent symbol needs escaping in latex
if matplotlib.rcParams['text.usetex'] is True:
return s + r'$\%$'
else:
return s + '%'
data = np.loadtxt('histogram.txt')
logdata = np.log(data+1)
num_bins = 50000
counts, bin_edges = np.histogram(logdata, bins=num_bins)
cdf = (np.cumsum(counts)/77824) * 100
plt.plot(bin_edges[1:], cdf)
formatter = FuncFormatter(to_percent)
plt.gca().yaxis.set_major_formatter(formatter)
plt.xlabel('log(No. of ListMemberships + 1)')
plt.ylabel('Cumulative Percentage')
plt.show()
What I'd like to do is adding additional information like CDF below with some texts (90%, 10% in y-axis) and additional red dotted lines within the plotted figure.