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

Skip to content

Commit cfb368a

Browse files
committed
Fix style sheet examples
1 parent ab29f84 commit cfb368a

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

examples/style_sheets/plot_bmh.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
def plot_beta_hist(ax, a, b):
1919
ax.hist(beta(a, b, size=10000), histtype="stepfilled",
2020
bins=25, alpha=0.8, normed=True)
21-
return ax
2221

2322

2423
fig, ax = plt.subplots()

examples/style_sheets/plot_fivethirtyeight.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,22 @@
1111
from matplotlib import pyplot as plt
1212
import numpy as np
1313

14+
plt.style.use('fivethirtyeight')
15+
1416
x = np.linspace(0, 10)
1517

1618
# Fixing random state for reproducibility
1719
np.random.seed(19680801)
1820

1921
fig, ax = plt.subplots()
2022

21-
with plt.style.context('fivethirtyeight'):
22-
ax.plot(x, np.sin(x) + x + np.random.randn(50))
23-
ax.plot(x, np.sin(x) + 0.5 * x + np.random.randn(50))
24-
ax.plot(x, np.sin(x) + 2 * x + np.random.randn(50))
25-
ax.plot(x, np.sin(x) - 0.5 * x + np.random.randn(50))
26-
ax.plot(x, np.sin(x) - 2 * x + np.random.randn(50))
27-
ax.plot(x, np.sin(x) + np.random.randn(50))
28-
ax.set_title("'fivethirtyeight' style sheet")
23+
ax.plot(x, np.sin(x) + x + np.random.randn(50))
24+
ax.plot(x, np.sin(x) + 0.5 * x + np.random.randn(50))
25+
ax.plot(x, np.sin(x) + 2 * x + np.random.randn(50))
26+
ax.plot(x, np.sin(x) - 0.5 * x + np.random.randn(50))
27+
ax.plot(x, np.sin(x) - 2 * x + np.random.randn(50))
28+
ax.plot(x, np.sin(x) + np.random.randn(50))
29+
ax.set_title("'fivethirtyeight' style sheet")
2930

3031

3132
plt.show()

0 commit comments

Comments
 (0)