zsh2270365028的个人博客分享 http://blog.sciencenet.cn/u/zsh2270365028

博文

[转载]python Bayesian Methods for Hackers style sheet-alpha=0.8

已有 962 次阅读 2022-1-20 16:41 |个人分类:Python|系统分类:科研笔记|文章来源:转载

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.

'bmh' style sheet

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




https://wap.sciencenet.cn/blog-587102-1321888.html

上一篇:[转载]python Bayesian Methods for Hackers style sheet
下一篇:[转载]python Marker reference
收藏 IP: 119.78.226.*| 热度|

0

该博文允许注册用户评论 请点击登录 评论 (0 个评论)

数据加载中...
扫一扫,分享此博文

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-5-19 06:43

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部