Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6f7a769 commit 6975bcbCopy full SHA for 6975bcb
1 file changed
examples/pylab_examples/stackplot_demo2.py
@@ -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