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

Skip to content

Commit f19400e

Browse files
committed
Simplify gaussian mixture.
1 parent 790c843 commit f19400e

1 file changed

Lines changed: 9 additions & 18 deletions

File tree

lib/matplotlib/tests/test_axes.py

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1721,33 +1721,24 @@ def test_stackplot_baseline():
17211721
np.random.seed(0)
17221722

17231723
def layers(n, m):
1724-
def bump(a):
1725-
x = 1 / (.1 + np.random.random())
1726-
y = 2 * np.random.random() - .5
1727-
z = 10 / (.1 + np.random.random())
1728-
a += x * np.exp(-((np.arange(m) / m - y) * z) ** 2)
17291724
a = np.zeros((m, n))
17301725
for i in range(n):
17311726
for j in range(5):
1732-
bump(a[:, i])
1727+
x = 1 / (.1 + np.random.random())
1728+
y = 2 * np.random.random() - .5
1729+
z = 10 / (.1 + np.random.random())
1730+
a[:, i] += x * np.exp(-((np.arange(m) / m - y) * z) ** 2)
17331731
return a
17341732

17351733
d = layers(3, 100)
17361734
d[50, :] = 0 # test for fixed weighted wiggle (issue #6313)
17371735

1738-
fig = plt.figure()
1739-
1740-
plt.subplot(2, 2, 1)
1741-
plt.stackplot(list(xrange(100)), d.T, baseline='zero')
1742-
1743-
plt.subplot(2, 2, 2)
1744-
plt.stackplot(list(xrange(100)), d.T, baseline='sym')
1745-
1746-
plt.subplot(2, 2, 3)
1747-
plt.stackplot(list(xrange(100)), d.T, baseline='wiggle')
1736+
fig, axs = plt.subplots(2, 2)
17481737

1749-
plt.subplot(2, 2, 4)
1750-
plt.stackplot(list(xrange(100)), d.T, baseline='weighted_wiggle')
1738+
axs[0, 0].stackplot(range(100), d.T, baseline='zero')
1739+
axs[0, 1].stackplot(range(100), d.T, baseline='sym')
1740+
axs[1, 0].stackplot(range(100), d.T, baseline='wiggle')
1741+
axs[1, 1].stackplot(range(100), d.T, baseline='weighted_wiggle')
17511742

17521743

17531744
@image_comparison(baseline_images=['bxp_baseline'],

0 commit comments

Comments
 (0)