I want to check if a random point is inside the normal distribution or not. As you can see from my code, I separate them using different colors; however, the result is wrong - the criterion is if a point is inside or outside of the distribution then color it accordingly.
import matplotlib.pyplot as plt
import numpy as np
import scipy.stats as stats
mu = 175
sigma = 10
xnormal = np.linspace(-3 * sigma + mu, 3 * sigma + mu, 1000)
xnormal = [int(x) for x in xnormal]
plt.plot(xnormal, stats.norm.pdf(xnormal, mu, sigma))
plt.axhline(y=0.04, color='r', linestyle='-')
N = 100
for i in range(N):
x = np.random.randint(145, 205)
y = np.random.uniform(0.0, 0.04)
if(y <= (xnormal.count(x)/1000)):
plt.scatter(x,y,None,'orange')
else:
plt.scatter(x,y,None,'b')
plt.show()