I need to plot a 2x2 array with values in greycsale. If I use the commands
plt.imshow(matrix_1, cmap = cm.Greys_r)
plt.show()
I got the image below, where the various pixels are not clearly separated. Do you know how to fix this?
I need to plot a 2x2 array with values in greycsale. If I use the commands
plt.imshow(matrix_1, cmap = cm.Greys_r)
plt.show()
I got the image below, where the various pixels are not clearly separated. Do you know how to fix this?
Specify interpolation='none'
:
plt.imshow(matrix_1, cmap = cm.Greys_r, interpolation='none')
interpolation : string, optional, default: None
Acceptable values are ‘none’, ‘nearest’, ‘bilinear’, ‘bicubic’, ‘spline16’, ‘spline36’, ‘hanning’, ‘hamming’, ‘hermite’, ‘kaiser’, ‘quadric’, ‘catrom’, ‘gaussian’, ‘bessel’, ‘mitchell’, ‘sinc’, ‘lanczos’
If interpolation is None, default to rc image.interpolation. See also the filternorm and filterrad parameters. If interpolation is ‘none’, then no interpolation is performed on the Agg, ps and pdf backends. Other backends will fall back to ‘nearest’.
http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.imshow