这是一个 MWE,可以在不知道您的数据源是什么样子以及您尝试使用什么 pdf 的情况下生成类似图像引用的内容。
import matplotlib.pyplot as plt
import scipy.stats as st
import numpy as np
x = np.linspace(0,1,500)
alpha = [0.01,1,5,10,20]
beta = [0.05,3,2.5,3.5,5]
fig, ax = plt.subplots(figsize=(9,7))
for params in zip(alpha,beta):
ypdf = st.beta.pdf(x,params[0],params[1])
label = r'$\alpha$='+str(params[0])+','+r'$\beta$='+str(params[1])
ax.plot(x,ypdf,label=label,linewidth=2)
ax.grid()
ax.legend(fontsize=14)
以上将产生以下情节: