In the numpy documentation, it is said that randn generates numbers from a gaussian distribution, so after generating an array from randn if I plot it why am I not getting a bell curve?
x = np.linspace(1,1000,1000)
y = np.random.randn(1,1000)
plt.scatter(x,y)
CodePudding user response:
Because you are plotting raw data. Bell curve tells about probability(frequency in this case). You need to plot frequency of unique samples.
This will show the bell curve you want.
plt.hist(y[0], bins=100);
y[0]
to make data 1D.
More the bins
, the finer the results.