import matplotlib.pyplot as plt
import numpy as np
_im1 = np.array([
[1, 1, 1, 1, 1],
[1, 1, 1, 1, 1],
[1, 1, 1, 1, 1],
[1, 1, 1, 1, 1],
[1, 1, 1, 1, 1]
]).astype(np.uint8)
_im2 = np.array([
[0, 0, 0, 0, 0],
[0, 0, 0, 0, 0],
[0, 0, 0, 0, 0],
[0, 0, 0, 0, 0],
[0, 0, 0, 0, 0]
]).astype(np.uint8)
fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(8, 8))
ax1.set_title('1s')
ax1.imshow(_im1 , cmap='binary')
ax2.set_title('Os')
ax2.imshow(_im2, cmap='binary')
plt.tight_layout()
plt.subplots_adjust(top=1)
plt.show()
plt.clf()
I am getting both the images to be white color. I have tried using cmap='grey' then both show as black I was using this has reference : Getting black plots with plt.imshow after multiplying image array by a scalar