cmap = plt.cm.gray
cmap.set_bad('white')
thresh = 3
for curcen, currad in zip(centers, radiuses):
    curim = ((xgrid - curcen[0]) ** 2 + (ygrid - curcen[1]) ** 2
        ) ** 0.5 / currad * thresh
im[curim < thresh] = np.exp(-0.5 * curim ** 2)[curim < thresh]
xs = np.append(xs, curcen[0] + currad * np.cos(fis))
ys = np.append(ys, curcen[1] + currad * np.sin(fis))
plt.imshow(im.T, cmap=cmap, extent=xr + yr)
plt.plot(xs, ys, 'r-')
matplotlib color gradient in patches?