from matplotlib import pyplot as plt import matplotlib.cm as cm plt.figure() # without this it display one after another plt.imshow(image_one, cmap=cm.gray) # without cm.gray it displays grayscale images in colormap plt.imshow(image_two, cmap=cm.gray) # plt.show()
use %matplotlib inline in ipython notebook to display image inplace
Shorter version: %matplotlib inline import matplotlib.pyplot as plt plt.axis(‘off’) plt.imshow(dpt, cmap=plt.cm.gray, interpolation=‘nearest’)