📜  imshow 将 nan 显示为黑色 - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:51.339000             🧑  作者: Mango

代码示例1
masked_array = np.ma.array (a, mask=np.isnan(a))
cmap = matplotlib.cm.jet
cmap.set_bad('white',1.)
ax.imshow(masked_array, interpolation='nearest', cmap=cmap)