我的代碼有問題。每次運行它看起來都不一樣。有任何想法嗎?我看不出有什么問題。我從 2 小時開始查看這段代碼,但我找不到問題...
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")
uj5u.com熱心網友回復:
您正在使用
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/479472.html
標籤:Python 麻木的 matplotlib 数学 scipy
上一篇:計算熊貓資料框列中唯一專案的數量
