matplotlib grayscale code example
Example 1: imshow grayscale
plt.imshow(im, cmap='gray')
Example 2: plt.imshow grayscale
plt.imshow(arr, cmap='gray', vmin=0, vmax=255)
plt.imshow(im, cmap='gray')
plt.imshow(arr, cmap='gray', vmin=0, vmax=255)