Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7b70d19

Browse files
more pep8
1 parent 2fba987 commit 7b70d19

2 files changed

Lines changed: 19 additions & 10 deletions

File tree

examples/style_sheets/plot_bmh.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
11
"""
22
This example demonstrates the "bmh" style, which is the design used in the
33
Bayesian Methods for Hackers online book.
4-
54
"""
65
from numpy.random import beta
76
import matplotlib.pyplot as plt
87

98
plt.style.use('bmh')
10-
plt.hist(beta(10,10,size=10000),histtype="stepfilled", bins=25, alpha=0.8, normed=True)
11-
plt.hist(beta(4,12,size=10000),histtype="stepfilled", bins=25, alpha=0.7, normed=True)
12-
plt.hist(beta(50,12,size=10000),histtype="stepfilled", bins=25, alpha=0.8, normed=True)
13-
plt.hist(beta(6,55,size=10000),histtype="stepfilled", bins=25, alpha=0.8, normed=True)
149

15-
plt.show()
10+
11+
def plot_beta_hist(a, b):
12+
plt.hist(beta(a, b, size=10000), histtype="stepfilled",
13+
bins=25, alpha=0.8, normed=True)
14+
return
15+
16+
plot_beta_hist(10, 10)
17+
plot_beta_hist(4, 12)
18+
plot_beta_hist(50, 12)
19+
plot_beta_hist(6, 55)
20+
21+
plt.show()
Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
"""
2-
This shows an example of the "fivethirtyeight" styling, which tries to replicate the styles from FiveThirtyEight.com.
2+
This shows an example of the "fivethirtyeight" styling, which
3+
tries to replicate the styles from FiveThirtyEight.com.
34
"""
45

56

67
from matplotlib import pyplot as plt
78
import numpy as np
89

9-
x = np.linspace(0,10)
10+
x = np.linspace(0, 10)
1011

1112
with plt.style.context('fivethirtyeight'):
1213
plt.plot(x, np.sin(x) + x + np.random.randn(50))
13-
plt.plot(x, np.sin(x) + 0.5*x + np.random.randn(50))
14-
plt.plot(x, np.sin(x) + 2*x + np.random.randn(50))
14+
plt.plot(x, np.sin(x) + 0.5 * x + np.random.randn(50))
15+
plt.plot(x, np.sin(x) + 2 * x + np.random.randn(50))
1516

17+
18+
plt.show()

0 commit comments

Comments
 (0)