How do I plot an image in gray scale? I would imagine the following example would do this, but I get a color image. Do I need to apply the colormap in some other way?
import numpy as np
import matplotlib.pyplot as plt
img2 = np.array([[[248, 255, 255],
[ 79, 109, 97],
[ 0, 15, 0],
[223, 255, 248],
[ 85, 87, 84]],
[[255, 255, 246],
[126, 106, 99],
[ 25, 0, 0],
[220, 175, 172],
[ 30, 17, 9]],
[[ 39, 0, 0],
[255, 175, 179],
[ 86, 0, 0],
[106, 0, 0],
[ 66, 0, 0]],
[[181, 35, 46],
[181, 32, 36],
[166, 42, 34],
[146, 43, 24],
[195, 20, 35]],
[[243, 0, 29],
[200, 22, 22],
[255, 202, 159],
[243, 255, 186],
[254, 0, 26]]], dtype='uint8')
plt.imshow(img2,cmap='gray')
plt.show()
I am working in python 2.7 in a jupyter notebook.