forked from HMMA238-2021/git-tutorial
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot.py
More file actions
23 lines (17 loc) · 636 Bytes
/
plot.py
File metadata and controls
23 lines (17 loc) · 636 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import numpy as np
import matplotlib.pyplot as plt
# Data are loaded from a file
gaussian = np.loadtxt('file_data_gaussian.csv')
chisqrd = np.loadtxt('file_data_chisqrd.csv')
# the histogram of the data
n, bins, patches = plt.hist(gaussian, 50, density=True, facecolor='r', alpha=0.74)
n, bins, patches = plt.hist(chisqrd, 50, density=True, facecolor='k', alpha=0.25)
plt.xlabel('Smarts')
plt.ylabel('Probability')
plt.title('Histogram of IQ')
plt.text(60, .025, r'$\mu=100,\ \sigma=15$')
plt.text(80, .020, r'$\mu=100,\ \sigma=5$ but this is no longer a Gaussian')
plt.xlim(40, 250)
plt.ylim(0, 0.03)
plt.grid(True)
plt.show()