I am generating normal distributions from the mean and standard deviation of a dataset with this code:
sampledRow = dataset.sample() # Get random item from the dataset
x = np.linspace(-10, 10, 1000) # Create X axis -10 to 10
# Normal Distribution using datas mean and sigma
y = norm.pdf(x, loc=sampledRow['Mean'], scale=sampledRow['Sigma'])
plt.plot(x, y)
plt.vlines(sampledRow['Fitness'], ymin=0, ymax=max(y), linestyles='--')
plt.show()
plt.close()
Some of my plots appear almost correct (figure 1), but unfortunately most of my plots look like figure 2 in which the y-axis goes far above 1. How can I change the way I handle my data to make the y-axis show probability density (proportion of probability of 100%), while maintaining a normal distribution?
Thank you!
Mean = -5.3, Sigma = 0.58
Mean = -1.1, Sigma = 0.065