I plotted two normal distribution curves on the graph as seen below:
Using the below code:
import random
import numpy as np
import matplotlib.pyplot as plt
d1 = np.array([random.randrange(0,100) for i in range(100)])
d2 = np.array([random.randrange(0,50) for i in range(100)])
d1,d2 = np.sort(d1),np.sort(d2)
d1_mean,d1_std = np.mean(d1),np.std(d1)
d2_mean,d2_std = np.mean(d2),np.std(d2)
# y = np.repeat(15,100)
plt.figure(figsize=(8,6))
plt.plot(d1,stats.norm.pdf(d1,d1_mean,d1_std)*1000,'r')
plt.plot(d2,stats.norm.pdf(d2,d2_mean,d2_std)*1000,'b')
# plt.hlines(y,d1.min(),d1.max(),'g')
plt.title("Flattening the curve")
plt.show()
What I want to achieve is this:
The second graph is easier to plot because both the mean for both the normal distribution curves for the above graph were the same. However, I am unable to achieve the same with the graph at the very top. When I set the mean to be similar, this happens:
Any tips on how to achieve this? Any help is much appreciated. Thank you for reading.



