|
14 | 14 |
|
15 | 15 | import numpy as np
|
16 | 16 | import matplotlib.cm as cm
|
17 |
| -import matplotlib.mlab as mlab |
18 | 17 | import matplotlib.pyplot as plt
|
19 | 18 | import matplotlib.cbook as cbook
|
20 | 19 | from matplotlib.path import Path
|
|
26 | 25 | delta = 0.025
|
27 | 26 | x = y = np.arange(-3.0, 3.0, delta)
|
28 | 27 | X, Y = np.meshgrid(x, y)
|
29 |
| -Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0) |
30 |
| -Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1) |
31 |
| -Z = Z2 - Z1 # difference of Gaussians |
| 28 | +Z1 = np.exp(-X**2 - Y**2) |
| 29 | +Z2 = np.exp(-(X - 1)**2 - (Y - 1)**2) |
| 30 | +Z = (Z1 - Z2) * 2 |
32 | 31 |
|
33 | 32 | im = plt.imshow(Z, interpolation='bilinear', cmap=cm.RdYlGn,
|
34 | 33 | origin='lower', extent=[-3, 3, -3, 3],
|
|
156 | 155 | delta = 0.025
|
157 | 156 | x = y = np.arange(-3.0, 3.0, delta)
|
158 | 157 | X, Y = np.meshgrid(x, y)
|
159 |
| -Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0) |
160 |
| -Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1) |
161 |
| -Z = Z2 - Z1 # difference of Gaussians |
| 158 | +Z1 = np.exp(-X**2 - Y**2) |
| 159 | +Z2 = np.exp(-(X - 1)**2 - (Y - 1)**2) |
| 160 | +Z = (Z1 - Z2) * 2 |
162 | 161 |
|
163 | 162 | path = Path([[0, 1], [1, 0], [0, -1], [-1, 0], [0, 1]])
|
164 | 163 | patch = PathPatch(path, facecolor='none')
|
|
0 commit comments