注解
Click here 下载完整的示例代码
黑客风格表的贝叶斯方法¶
这个例子演示了用于黑客的贝叶斯方法中的样式。 [1] 在线图书。
[1] | http://camdavidsonpilon.github.io/Probabilistic-Programming-and-Bayesian-Methods-for-Hackers/ |
import numpy as np
import matplotlib.pyplot as plt
# Fixing random state for reproducibility
np.random.seed(19680801)
plt.style.use('bmh')
def plot_beta_hist(ax, a, b):
ax.hist(np.random.beta(a, b, size=10000),
histtype="stepfilled", bins=25, alpha=0.8, density=True)
fig, ax = plt.subplots()
plot_beta_hist(ax, 10, 10)
plot_beta_hist(ax, 4, 12)
plot_beta_hist(ax, 50, 12)
plot_beta_hist(ax, 6, 55)
ax.set_title("'bmh' style sheet")
plt.show()
关键词:matplotlib代码示例,codex,python plot,pyplot Gallery generated by Sphinx-Gallery