matplotlib在Jupyter Notebook上不显示图像 [英] matplotlib not displaying image on Jupyter Notebook

查看:282
本文介绍了matplotlib在Jupyter Notebook上不显示图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用ubuntu 14.04,并在jupyter笔记本中使用anaconda2.7进行编码,其他所有内容都是最新的.今天,我正在编码,一切正常.我关闭了笔记本,当我重新打开笔记本时,除了没有显示图像之外,其他所有东西都工作正常.

I am using ubuntu 14.04 and coding in jupyter notebook using anaconda2.7 and everything else is up to date . Today I was coding, every thing worked fine. I closed the notebook and when I reopened it, every thing worked fine except that the image was not being displayed.

%matplotlib inline
import numpy as np
import skimage
from skimage import data
from matplotlib import pyplot as plt
%pylab inline

img = data.camera()
plt.imshow(img,cmap='gray')

这是我正在使用的代码,一个非常简单的代码,但是不显示图像

this is the code i am using, a really simple one but doesn't display the image

<matplotlib.image.AxesImage at 0xaf7017ac>

这将显示在输出区域中请帮助

this is displayed in the output area please help

推荐答案

您需要告诉matplotlib实际显示图像.将此添加到您的细分受众群的末尾:

You need to tell matplotlib to actually show the image. Add this at the end of your segment:

plt.show()

这篇关于matplotlib在Jupyter Notebook上不显示图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆