我正在用python编写一个程序,包有numpy、scipy和matplotlib.pyplot。这是我的代码:
import matplotlib.pyplot as plt
from scipy import misc
im=misc.imread("photosAfterAverage/exampleAfterAverage1.jpg")
plt.imshow(im, cmap=plt.cm.gray)
由于某种原因,图像没有显示出来(如果我得到了图像,检查一下,在那部分一切都很好-我可以打印数组)。
Tags:
“交互模式也可以通过
matplotlib.pyplot.ion()
打开,通过matplotlib.pyplot.ioff()
”cf. matplotlib user guide关闭。您需要调用
plt.show()
来显示图像。或者使用ipython --pylab
作为可识别matplotlib
的交互式shell。相关问题 更多 >
编程相关推荐