Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to show numpy 2d array as grayscale image in Jupyter Notebook? [duplicate]

I have numpy array with the following properties.

np.shape(I)
(300, 300)

np.min(I)
115

np.max(I)
250

Unfortunately, when I plot it, I get something greenish bluish.

How to get normal grayscale palette?

enter image description here

like image 771
Dims Avatar asked Jun 27 '18 13:06

Dims


Video Answer


1 Answers

Try this one:

imgplot = plt.imshow(I, cmap='gray')
like image 143
Bogdan Osyka Avatar answered Oct 15 '22 23:10

Bogdan Osyka