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

Skip to content

Commit f5459d1

Browse files
committed
updated the pyplot fill_between example to elucidate the premise;making the chart more readable and removing unnecessary confusing code
1 parent abe0e39 commit f5459d1

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

examples/pyplots/whats_new_98_4_fill_between.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@
22
=============================
33
Whats New 0.98.4 Fill Between
44
=============================
5-
5+
generates an example of using the fill_between() method with opposing two quadratics
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('Highlight Between and Intercept')
1919

2020
plt.show()

0 commit comments

Comments
 (0)