I have a problem with my code. It looks different everytime i run it. Any ideas? I don't see any problem. I am looking at this code since 2h and I can't find the problem...
import numpy as np
import matplotlib.pyplot as plt
from scipy import stats
x = np.arange(0,24, 1)
y = stats.poisson.pmf(x, mu=13)
a =stats.poisson.rvs(mu=13, size=5000)
#plt.stem(a,x)
plt.hist(a,bins=x,density=True,edgecolor="red")
plt.title("Poisson Verteilung mit Erwartungswert 13")
plt.xlabel("Anzahl M.")
plt.ylabel("Wahrscheinlichkeit")
"""
i=10
o=30
while i != o:
if y[i]*100<0.5:
#print(i)
break
i =1
"""
#plot to specific x value
plt.xlim(0, 23)
plt.plot()
plt.plot(13, y[13], marker='x', markersize=5, color="black",label="Varianz")
plt.plot(13, y[13], marker='x', markersize=5, color="black",label="Median")
plt.legend(loc="upper left")
CodePudding user response: