Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 6975bcb

Browse filesBrowse files
committed
Add stackplot baseline demo
1 parent 6f7a769 commit 6975bcb
Copy full SHA for 6975bcb

File tree

Expand file treeCollapse file tree

1 file changed

+23
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+23
-0
lines changed
+23Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.