From 6e245a93595f1948575eb727040688a9a5ffc15a Mon Sep 17 00:00:00 2001 From: goujilinouhaila-coder Date: Wed, 3 Feb 2021 19:09:05 +0100 Subject: [PATCH 1/3] I edited line8 --- plot.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/plot.py b/plot.py index 8f62462..c0e0411 100644 --- a/plot.py +++ b/plot.py @@ -5,13 +5,13 @@ x = np.loadtxt('file_data.csv') # the histogram of the data -n, bins, patches = plt.hist(x, 50, density=True, facecolor='r, alpha=0.74) +n, bins, patches = plt.hist(x, 50, density=True, facecolor='r', alpha=0.74) - plt.xlabel('Smarts') - plt.ylabel('Probability') - plt.title('Histogram of IQ') - plt.text(60, .025, r'$\mu=100,\ \sigma=15$') - plt.xlim(40, 160) - plt.ylim(0, 0.03) - plt.grid(True) - plt.show() +plt.xlabel('Smarts') +plt.ylabel('Probability') +plt.title('Histogram of IQ') +plt.text(60, .025, r'$\mu=100,\ \sigma=15$') +plt.xlim(40, 160) +plt.ylim(0, 0.03) +plt.grid(True) +plt.show() From 74ed851e322132648b03d29e50efa7af446e5cc2 Mon Sep 17 00:00:00 2001 From: goujilinouhaila-coder Date: Wed, 10 Feb 2021 21:17:30 +0100 Subject: [PATCH 2/3] merged the branch NonGaussian to the branch master --- generate_data.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/generate_data.py b/generate_data.py index ddd5020..7959374 100644 --- a/generate_data.py +++ b/generate_data.py @@ -1,4 +1,5 @@ import numpy as np +import matplotlib.pyplot as plt # Fixing random state for reproducibility np.random.seed(19680801) @@ -6,4 +7,13 @@ mu, sigma = 100, 15 x_gaussian = mu + sigma * np.random.randn(10000) -np.savetxt('file_data.csv', x_gaussian, delimiter=',') +mu, sigma = 100, 5 +x_chisqrd = mu + sigma * (np.random.randm(10,10000)**2).sum(0) + + + + + + +np.savetxt('file_data_gaussian.csv', x_gaussian, delimiter=',') +np.savetxt('file_data_chisqrd.csv', x_chisqrd, delimiter=',') From 2607571346d2b0153055ce3028c45f2dd9ef127b Mon Sep 17 00:00:00 2001 From: goujilinouhaila-coder Date: Wed, 10 Feb 2021 21:30:58 +0100 Subject: [PATCH 3/3] Plots of the two histogram on a same plot --- plot.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/plot.py b/plot.py index c0e0411..f76b08b 100644 --- a/plot.py +++ b/plot.py @@ -2,16 +2,18 @@ import matplotlib.pyplot as plt # Data are loaded from a file -x = np.loadtxt('file_data.csv') - +gaussian = np.loadtxt('file_data_gaussian.csv') +chisqrd = np.loadtxt('file_data_chisqrd.csv') # the histogram of the data -n, bins, patches = plt.hist(x, 50, density=True, facecolor='r', alpha=0.74) +n, bins, patches = plt.hist(gaussian, 50, density=True, facecolor='r', alpha=0.74) +n, bins, patches = plt.hist(chisqrd, 50, density=True, facecolor='b', alpha=0.25) plt.xlabel('Smarts') plt.ylabel('Probability') plt.title('Histogram of IQ') plt.text(60, .025, r'$\mu=100,\ \sigma=15$') -plt.xlim(40, 160) +plt.text(80, .020, r'$\mu=100,\ \sigma=5$') +plt.xlim(40, 250) plt.ylim(0, 0.03) plt.grid(True) plt.show()