def norm_axesimage(ax, vmin, vmax):
try:
axim = ax.get_images()[0]
except IndexError:
return
im = axim.get_array()
if im.ndim == 3: # RGB, custom norm
if vmax - vmin > 0:
# the masked array may give underflowerror here
with np.errstate(under='ignore'):
axim.set_array((im - vmin) / (vmax - vmin))
axim.set_clim(0, 1) # this is actually ignored for RGB by mpl
else: # use built-in
axim.set_clim(vmin, vmax)
return axim
评论列表
文章目录