@unutbu's answer is quite close to the right answer.
By default, plt.imshow() will try to scale your (MxN) array data to 0.0~1.0. And then map to 0~255. For most natural taken images, this is fine, you won't see a different. But if you have narrow range of pixel value image, say the min pixel is 156 and the max pixel is 234. The gray image will looks totally wrong. The right way to show an image in gray is
from matplotlib.colors import NoNorm
...
plt.imshow(img,cmap='gray',norm=NoNorm())
...
Let's see an example:
this is the origianl image: original
this is using defaul norm setting,which is None: wrong pic
this is using NoNorm setting,which is NoNorm(): right pic