def scatter(self, lvl=None, **kwargs):
defaults = {'c': '0.0', 'color':'k', 'facecolor':'k', 'edgecolor':'None'}
defaults.update(**kwargs)
xe = self.e[0] + self.dx * np.arange(0, self.im.shape[1])
ye = self.e[2] + self.dy * np.arange(0, self.im.shape[0])
x = self.x
y = self.y
if lvl is not None:
nx = np.ceil(np.interp(x, 0.5 * (xe[:-1] + xe[1:]), range(len(xe) - 1)))
ny = np.ceil(np.interp(y, 0.5 * (ye[:-1] + ye[1:]), range(len(ye) - 1)))
nh = [ self.im[nx[k], ny[k]] for k in range(len(x)) ]
ind = np.where(nh < np.min(lvl))
plt.scatter(x[ind], y[ind], **kwargs)
else:
plt.scatter(x, y, **kwargs)
评论列表
文章目录