Created
August 31, 2015 16:20
-
-
Save garaemon/4302e8171c4e6b24543c to your computer and use it in GitHub Desktop.
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
| #!/usr/bin/env python | |
| import matplotlib.pyplot as plt | |
| import numpy as np | |
| import matplotlib.mlab as mlab | |
| import math | |
| import sys | |
| if len(sys.argv) != 3: | |
| print "plot_gaussian.py mean variance" | |
| sys.exit(1) | |
| mean = float(sys.argv[1]) | |
| variance = float(sys.argv[2]) | |
| sigma = math.sqrt(variance) | |
| x = np.linspace(-3*sigma+mean,3*sigma+mean,100) | |
| plt.plot(x, mlab.normpdf(x,mean,sigma), '#dddddd') | |
| plt.ylim([0, 1]) | |
| plt.xlim([-3*sigma+mean,3*sigma+mean]) | |
| plt.fill_between(x, mlab.normpdf(x,mean,sigma), facecolor='#dddddd') | |
| plt.axis('off') | |
| plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment