2019年3月2日 星期六

[ Python 常見問題 ] How to embed image or picture in jupyter notebook?

Source from here
Question
I would like to include image in a jupyter notebook. If I did the following, it works:
  1. from IPython.display import Image  
  2. Image("img/picture.png")  
But I would like to include the images in a markdown cell. How to do it?

How-To
If your image file is in local, you can use below syntax:
  1. ![title](img/picture.png)  
which assumed that you have the following file structure and that you run the jupyter notebook command in the directory where the file example.ipynb (<-- contains="" font="" for="" image="" markdown="" the="">) is stored: 
  1. /  
  2. +-- example.ipynb  
  3. +-- img  
  4.     +-- picture.png  
Alternatively, you can use a plain HTML <img src/>, which allows you to change height and width and is still read by the markdown interpreter: 
  1. <image src="img/picture.png",width=60,height=60/>  


沒有留言:

張貼留言

[Git 常見問題] error: The following untracked working tree files would be overwritten by merge

  Source From  Here 方案1: // x -----删除忽略文件已经对 git 来说不识别的文件 // d -----删除未被添加到 git 的路径中的文件 // f -----强制运行 #   git clean -d -fx 方案2: 今天在服务器上  gi...