是否使用IPython.display将图像排列到子批次?

是否使用IPython.display将图像排列到子批次?,ipython,jupyter-notebook,Ipython,Jupyter Notebook,如何使用IPython.display将图像列表显示为子批次 我使用了以下代码: from IPython.display import Image from IPython.display import display x1 = Image(url='http://image1.png',width=100,height=100) x2 = Image(url='http://image2.png',width=100,height=100) x3 = Image(url='http:/

如何使用IPython.display将图像列表显示为子批次

我使用了以下代码:

from IPython.display import Image
from IPython.display import display

x1 = Image(url='http://image1.png',width=100,height=100) 
x2 = Image(url='http://image2.png',width=100,height=100) 
x3 = Image(url='http://image3.png',width=100,height=100) 
x4 = Image(url='http://image4.png',width=100,height=100) 

display(x1,x2,x3,x4)
它在IPython笔记本电池中垂直显示了4幅图像


我想他们被安排成一个2x2阵列

我建议您使用
matplotlib.pyplot
中的
subplot
。要显示图像,请使用
imshow
功能。

如果不需要在代码单元格内显示图像,可以使用标记表在标记单元格中以表格格式显示图像

| Col header A                  | Col header B                  |
|:-----------------------------:|:-----------------------------:|
| <img src="http://image1.png"> | <img src="http://image2.png"> |
| <img src="http://image3.png"> | <img src="http://image4.png"> |
|列标题A |列标题B|
|:-----------------------------:|:-----------------------------:|
|  |  |
|  |  |

.

IPython没有在网格中显示图像的内置设备。您需要使用matplotlib或PIL之类的东西将它们组合成一个图像,或者构建HTML以按照您的意愿进行布局并显示它们。我明白了。非常感谢。我去查一下PIL。