{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n# Bayesian Methods for Hackers style sheet\n\nThis example demonstrates the style used in the Bayesian Methods for Hackers\n[1]_ online book.\n\n.. [1] http://camdavidsonpilon.github.io/Probabilistic-Programming-and-Bayesian-Methods-for-Hackers/\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "import matplotlib.pyplot as plt\nimport numpy as np\n\n# Fixing random state for reproducibility\nnp.random.seed(19680801)\n\nplt.style.use('bmh')\n\n\ndef plot_beta_hist(ax, a, b):\n ax.hist(np.random.beta(a, b, size=10000),\n histtype=\"stepfilled\", bins=25, alpha=0.8, density=True)\n\n\nfig, ax = plt.subplots()\nplot_beta_hist(ax, 10, 10)\nplot_beta_hist(ax, 4, 12)\nplot_beta_hist(ax, 50, 12)\nplot_beta_hist(ax, 6, 55)\nax.set_title(\"'bmh' style sheet\")\n\nplt.show()" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.13.2" } }, "nbformat": 4, "nbformat_minor": 0 }