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

Skip to content

Commit 6975bcb

Browse files
committed
Add stackplot baseline demo
1 parent 6f7a769 commit 6975bcb

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import numpy as np
2+
import matplotlib.pyplot as plt
3+
4+
np.random.seed(0)
5+
def layers(n, m):
6+
def bump(a):
7+
x = 1 / (.1 + np.random.random())
8+
y = 2 * np.random.random() - .5
9+
z = 10 / (.1 + np.random.random())
10+
for i in range(m):
11+
w = (i / float(m) - y) * z
12+
a[i] += x * np.exp(-w * w)
13+
a = np.zeros((m, n))
14+
for i in range(n):
15+
for j in range(5):
16+
bump(a[:, i])
17+
return a
18+
19+
d=layers(3, 100)
20+
21+
plt.subplots()
22+
plt.stackplot(range(100), d.T, baseline='wiggle')
23+
plt.show()

0 commit comments

Comments
 (0)