forked from matplotlib/matplotlib.github.com
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot_bmh.html
More file actions
177 lines (146 loc) · 8.97 KB
/
Copy pathplot_bmh.html
File metadata and controls
177 lines (146 loc) · 8.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>style_sheets example code: plot_bmh.py — Matplotlib 1.4.2 documentation</title>
<link rel="stylesheet" href="../../_static/mpl.css"
type="text/css" />
<link rel="stylesheet" href="../../_static/pygments.css"
type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../../',
VERSION: '1.4.2',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="../../_static/jquery.js"></script>
<script type="text/javascript" src="../../_static/underscore.js"></script>
<script type="text/javascript" src="../../_static/doctools.js"></script>
<link rel="search" type="application/opensearchdescription+xml"
title="Search within Matplotlib 1.4.2 documentation"
href="../../_static/opensearch.xml"/>
<link rel="top" title="Matplotlib 1.4.2 documentation" href="../../index.html" />
<link rel="up" title="style_sheets Examples" href="index.html" />
<link rel="next" title="style_sheets example code: plot_dark_background.py" href="plot_dark_background.html" />
<link rel="prev" title="style_sheets Examples" href="index.html" />
<link href="http://fonts.googleapis.com/css?family=Raleway" rel="stylesheet" type="text/css">
</head>
<body>
<link rel="shortcut icon" href="/_static/favicon.ico">
<!-- The "Fork me on github" ribbon -->
<img style="float: right; margin-bottom: -40px; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_orange_ff7600.png" usemap="#ribbonmap"/>
<map name="ribbonmap">
<area shape="poly" coords="15,0,148,-1,148,135" href="https://github.com/matplotlib/matplotlib" title="Fork me on GitHub" />
</map>
<div style="background-color: white; text-align: left; padding: 10px 10px 15px 15px">
<a href="../../index.html"><img src="../../_static/logo2.png" border="0" alt="matplotlib"/></a>
</div>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../../genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="plot_dark_background.html" title="style_sheets example code: plot_dark_background.py"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="index.html" title="style_sheets Examples"
accesskey="P">previous</a> |</li>
<li><a href="../../index.html">home</a>| </li>
<li><a href="../index.html">examples</a>| </li>
<li><a href="../../gallery.html">gallery</a>| </li>
<li><a href="../../api/pyplot_summary.html">pyplot</a>| </li>
<li><a href="../../contents.html">docs</a> »</li>
<li><a href="../index.html" >Matplotlib Examples</a> »</li>
<li><a href="index.html" accesskey="U">style_sheets Examples</a> »</li>
</ul>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<h4>Previous topic</h4>
<p class="topless"><a href="index.html"
title="previous chapter">style_sheets Examples</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="plot_dark_background.html"
title="next chapter">style_sheets example code: plot_dark_background.py</a></p>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../../_sources/examples/style_sheets/plot_bmh.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3>Quick search</h3>
<form class="search" action="../../search.html" method="get">
<input type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
<p class="searchtip" style="font-size: 90%">
Enter search terms or a module, class or function name.
</p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="section" id="style-sheets-example-code-plot-bmh-py">
<span id="style-sheets-plot-bmh"></span><h1>style_sheets example code: plot_bmh.py<a class="headerlink" href="#style-sheets-example-code-plot-bmh-py" title="Permalink to this headline">¶</a></h1>
<p>(<a class="reference external" href="../../mpl_examples/style_sheets/plot_bmh.py">Source code</a>, <a class="reference external" href="../../mpl_examples/style_sheets/plot_bmh.png">png</a>, <a class="reference external" href="../../mpl_examples/style_sheets/plot_bmh.hires.png">hires.png</a>, <a class="reference external" href="../../mpl_examples/style_sheets/plot_bmh.pdf">pdf</a>)</p>
<div class="figure">
<img alt="../../_images/plot_bmh.png" src="../../_images/plot_bmh.png" />
</div>
<div class="highlight-python"><div class="highlight"><pre><span class="sd">"""</span>
<span class="sd">This example demonstrates the "bmh" style, which is the design used in the</span>
<span class="sd">Bayesian Methods for Hackers online book.</span>
<span class="sd">"""</span>
<span class="kn">from</span> <span class="nn">numpy.random</span> <span class="kn">import</span> <span class="n">beta</span>
<span class="kn">import</span> <span class="nn">matplotlib.pyplot</span> <span class="kn">as</span> <span class="nn">plt</span>
<span class="n">plt</span><span class="o">.</span><span class="n">style</span><span class="o">.</span><span class="n">use</span><span class="p">(</span><span class="s">'bmh'</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">plot_beta_hist</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">):</span>
<span class="n">plt</span><span class="o">.</span><span class="n">hist</span><span class="p">(</span><span class="n">beta</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="mi">10000</span><span class="p">),</span> <span class="n">histtype</span><span class="o">=</span><span class="s">"stepfilled"</span><span class="p">,</span>
<span class="n">bins</span><span class="o">=</span><span class="mi">25</span><span class="p">,</span> <span class="n">alpha</span><span class="o">=</span><span class="mf">0.8</span><span class="p">,</span> <span class="n">normed</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
<span class="k">return</span>
<span class="n">plot_beta_hist</span><span class="p">(</span><span class="mi">10</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
<span class="n">plot_beta_hist</span><span class="p">(</span><span class="mi">4</span><span class="p">,</span> <span class="mi">12</span><span class="p">)</span>
<span class="n">plot_beta_hist</span><span class="p">(</span><span class="mi">50</span><span class="p">,</span> <span class="mi">12</span><span class="p">)</span>
<span class="n">plot_beta_hist</span><span class="p">(</span><span class="mi">6</span><span class="p">,</span> <span class="mi">55</span><span class="p">)</span>
<span class="n">plt</span><span class="o">.</span><span class="n">show</span><span class="p">()</span>
</pre></div>
</div>
<p>Keywords: python, matplotlib, pylab, example, codex (see <a class="reference internal" href="../../faq/howto_faq.html#how-to-search-examples"><em>Search examples</em></a>)</p>
</div>
</div>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="footer">
© Copyright 2002 - 2012 John Hunter, Darren Dale, Eric Firing, Michael Droettboom and the matplotlib development team; 2012 - 2014 The matplotlib development team.
Last updated on Oct 25, 2014.
Created using <a
href="http://sphinx-doc.org/">Sphinx</a> 1.3b2.
</div>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-55954603-1', 'auto');
ga('send', 'pageview');
</script>
</body>
</html>