imshow() function not working


Question

I'm working on a program in python with packages numpy,scipy and matplotlib.pyplot. This is my code:

import matplotlib.pyplot as plt
from scipy import misc
im=misc.imread("photosAfterAverage/exampleAfterAverage1.jpg")
plt.imshow(im, cmap=plt.cm.gray)

for some reason the image isn't showing up (checked if I got the image, in that part it's all fine- I can print the array.).

1
43
5/9/2013 2:57:17 PM

You need to call plt.show() to display the image. Or use ipython --pylab for an interactive shell that is matplotlib aware.

74
5/9/2013 2:56:05 PM

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon