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

Skip to content

Commit 64050ca

Browse files
authored
Merge pull request #10967 from bellmj/fillBetweenExampleBranch
updated the pyplot fill_between example to elucidate the premise;maki…
2 parents f086513 + 09f6dfd commit 64050ca

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed
Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
"""
2-
=============================
3-
Whats New 0.98.4 Fill Between
4-
=============================
2+
============
3+
Fill Between
4+
============
55
66
"""
77
import matplotlib.pyplot as plt
88
import numpy as np
99

10-
x = np.arange(0.0, 2, 0.01)
11-
y1 = np.sin(2*np.pi*x)
12-
y2 = 1.2*np.sin(4*np.pi*x)
10+
x = np.arange(-5, 5, 0.01)
11+
y1 = -5*x*x + x + 10
12+
y2 = 5*x*x + x
1313

1414
fig, ax = plt.subplots()
1515
ax.plot(x, y1, x, y2, color='black')
16-
ax.fill_between(x, y1, y2, where=y2>y1, facecolor='green')
17-
ax.fill_between(x, y1, y2, where=y2<=y1, facecolor='red')
18-
ax.set_title('fill between where')
16+
ax.fill_between(x, y1, y2, where=y2 >y1, facecolor='yellow', alpha=0.5)
17+
ax.fill_between(x, y1, y2, where=y2 <=y1, facecolor='red', alpha=0.5)
18+
ax.set_title('Fill Between')
1919

2020
plt.show()

0 commit comments

Comments
 (0)