I have created a histogram of Muon decays and want to find the r^2 value and display the function for the curve of best fit that I have graphed.
I am using scipy.stats expon.fit function to generate the curve, how would I go about displaying the generated curve as an equation and the corresponding r^2 value?
I have tried google the problem. Everything I have found has been for scatter plots or for np.polyfit. I have tried print(P), but of course it just printed ordered pairs.
#The Code
P = ss.expon.fit(data.deltaT)
rX = np.linspace(0, 10000, 321)
rP = ss.expon.pdf(rX,* * *P)
plt.hist(data.deltaT,bins=30, normed=True, color='slategrey')
plt.plot(rX, rP, color='darkturquoise')
plt.show()
Thank you for the help!