I have a 3x3 numpy array with 1s and 0s. For example:
[[0,1,0],
[0,0,1],
[1,0,0]
I am displaying it in black and white using matplotlib:
plt.imshow(X,interpolation='nearest',cmap=plt.cm.gray)
When the array has both 1s and 0s, it produces a correct image.
But when all the values are 0s it displays all black, signifying an all 1 array, which is incorrect:
array = [[0,0,0],[0,0,0],[0,0,0]] # displays black image (correct)
array = [[1,1,1],[1,1,1],[1,1,1]] #displays black image (incorrect)
How do I go about solving this?