I try to visualize a numpy array to image. But the array contains negative values or values that out of bound.
I have get an image successfully, but I have some question about gray scale.
How does it interpret through the colormap ?. (In principle, if the array is a float array scaled to 0..1, it should be interpreted as a grayscale image) So, what is the principle?
Thank you very much for your collaboration.
V = np.loadtxt('np.txt')
fig = plt.figure()
ax = fig.add_subplot(1, 1, 1)
ax.matshow(V, cmap = matplotlib.cm.binary)
plt.show()
The np array like:
[ [....]
....
[ 7.47859700e-03 -4.42994573e-03 -3.15871151e-02 4.57486308e-02
4.58066400e-02 7.81800849e-02 1.41268438e-01 2.67617603e-01
3.98583385e-01 3.85877649e-01 1.92501545e-01 2.65159152e-01
2.10979793e-01 2.48940247e-01 1.75112904e-01 -3.06361785e-02
2.74774650e-01 1.81465161e-01 4.23131349e-03 -3.56762525e-02
-1.72089055e-02 -4.25273422e-02 -2.63428158e-02 -4.59487077e-02
-2.30976482e-02 -4.45129524e-02 8.95580352e-03 1.56548770e-03]
...
[...] ]