|||
refer to: https://matplotlib.org/stable/gallery/style_sheets/bmh.html#sphx-glr-gallery-style-sheets-bmh-py
This example demonstrates the style used in the Bayesian Methods for Hackers1 online book.
import numpy as npimport matplotlib.pyplot as plt# Fixing random state for reproducibilitynp.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()
Archiver|手机版|科学网 ( 京ICP备07017567号-12 )
GMT+8, 2024-11-20 04:35
Powered by ScienceNet.cn
Copyright © 2007- 中国科学报社