Last active
April 8, 2018 20:02
-
-
Save gunnarvoet/69f2a446bc896fa476f3 to your computer and use it in GitHub Desktop.
Plot a histogram and fit a normal pdf in python
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
plt.hist(data),normed=True,stacked=True,facecolor='0.5'); | |
from scipy.stats import norm | |
mu, std = norm.fit(data) | |
std = float(std) | |
xmin, xmax = plt.xlim() | |
x = np.linspace(xmin, xmax, 100) | |
p = norm.pdf(x, mu, std) | |
plt.plot(x, p, 'k', linewidth=2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment