I want to make a color plot of probabilities however imshow generates blurry values for points which have zero probability. How can I get rid of this blurry periphery around real grid points?
Example:
import numpy as np
import matplotlib.pyplot as plt
a=np.asarray([[ 0.00000000e+00 , 1.05824446e-01 , 2.05086136e-04, 0.00000000e+00],
[ 1.05824446e-01 , 3.15012305e-01 , 1.31255127e-01 , 1.05209188e-01],
[ 2.05086136e-04 , 1.31255127e-01 , 0.00000000e+00 , 0.00000000e+00],
[ 0.00000000e+00 ,1.05209188e-01 , 0.00000000e+00 , 0.00000000e+00]])
im=plt.imshow(a,extent=[0,4,0,4],origin='lower',alpha=1,aspect='auto')
plt.show()
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…