绘制贝塔分布的时候感觉太小看不清
import numpy as np
from scipy import stats
import matplotlib.pyplot as plt
%matplotlib inline
x = np.linspace(0, 1, 100)
labels = []
a_list, b_list = [0.5, 5, 1, 2, 2], [0.5, 1, 3, 2, 5]
for a, b in zip(a_list, b_list):
labels.append('α={}, β={}'.format(a, b))
y = stats.beta(a=a, b=b).pdf(x)
plt.axis([0, 1.0, 0, 2.5])
plt.tick_params(axis='both', labelsize=14)
plt.plot(x, y)
plt.plot()
plt.legend(labels=labels, loc='best')
设置figure,函数原型Figure(figsize=None, dpi=None, facecolor=None, edgecolor=None, linewidth=0.0, frameon=None, subplotpars=None, tight_layout=None, constrained_layout=None)
figsize,图像尺寸,默认为[6.4, 4.8]
dpi,分辨率,默认为100.0
plt.figure(figsize=(a, b), dpi=dpi)