只是
面罩
你的“河”阵。
e.g.
rivers = np.ma.masked_where(rivers == 0, rivers)
As a quick example of overlaying two plots in this manner:
import numpy as npimport matplotlib.pyplot as pltimport matplotlib.cm as cm# Generate some data...gray_data = np.arange(10000).reshape(100, 100)masked_data = np.random.random((100,100))masked_data = np.ma.masked_where(masked_data < 0.9, masked_data)# Overlay the two imagesfig, ax = plt.subplots()ax.imshow(gray_data, cmap=cm.gray)ax.imshow(masked_data, cmap=cm.jet, interpolation='none')plt.show()
另外,另一方面,
imshow很乐意接受RGBA格式的float。
它只希望所有内容都在0到1之间。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)