Bayesian Methods for Hackers style sheetΒΆ

This example demonstrates the style used in the Bayesian Methods for Hackers [1] online book.

'bmh' style sheet
import numpy as np
import matplotlib.pyplot as plt

# Fixing random state for reproducibility

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")

Keywords: matplotlib code example, codex, python plot, pyplot Gallery generated by Sphinx-Gallery