Python 3.x 如何从两侧模糊形状?

Python 3.x 如何从两侧模糊形状?,python-3.x,matplotlib,Python 3.x,Matplotlib,请在下面的脚本中如何从两侧模糊这个环 import numpy as np import matplotlib.pyplot as plt n, radii = 50, [.7, .95] theta = np.linspace(0, 2*np.pi, n, endpoint=True) xs = np.outer(radii, np.cos(theta)) ys = np.outer(radii, np.sin(theta)) # in order to have a closed are

请在下面的脚本中如何从两侧模糊这个环

import numpy as np
import matplotlib.pyplot as plt

n, radii = 50, [.7, .95]
theta = np.linspace(0, 2*np.pi, n, endpoint=True)
xs = np.outer(radii, np.cos(theta))
ys = np.outer(radii, np.sin(theta))

# in order to have a closed area, the circles
# should be traversed in opposite directions
xs[1,:] = xs[1,::-1]
ys[1,:] = ys[1,::-1]

ax = plt.subplot(111, aspect='equal')
ax.fill(np.ravel(xs), np.ravel(ys), edgecolor='#348ABD')

plt.show()

下面是一种创建图像并应用高斯模糊的方法:

将numpy导入为np
将matplotlib.pyplot作为plt导入
从matplotlib.colors导入LinearSegmentedColormap
从scipy导入ndimage
rad1,rad2=.7,.95
rad_max=1.2
x=np.linspace(-rad_max,rad_max,500)
y=np.linspace(-rad_max,rad_max,500)
r=np.sqrt(x[:,np.newaxis]**2+y[np.newaxis,:]**2)
img=np.数组((r>rad1)和(r

非常感谢