There is an interpolation option for imshow
which controls how and if interpolation will be applied to the rendering of the matrix. If you try
imshow(array, interpolation="nearest")
you might get something more like you want. As an example
A=10*np.eye(10) + np.random.rand(100).reshape(10,10)
imshow(A)
compared with
A=10*np.eye(10) + np.random.rand(100).reshape(10,10)
imshow(A, interpolation="nearest")
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…