import matplotlib.pyplot as plt
fig = plt.figure(figsize = (16, 4))
ax = plt.subplot(1,11,1)
ax.axis('off')
imshow(img, 'first')
ax = plt.subplot(1,11,2)
ax.axis('off')
imshow(img2)
ax.set_title(2, color = 'red')
fig.show()
fig.savefig("show.png")
matplotlib.pyplot.figure(num=None, figsize=None, dpi=None, facecolor=None, edgecolor=None)
所有参数都是可选的,都有默认值,因此调用该函数时可以不带任何参数,其中:
num: 整型或字符型都可以。如果设置为整型,则该整型数字表示窗口的序号。如果设置为字符型,则该字符串表示窗口的名称。用该参数来命名窗口,如果两个窗口序号或名相同,则后一个窗口会覆盖前一个窗口。
figsize: 设置窗口大小。是一个tuple型的整数,如figsize=(8,8)
dpi: 整形数字,表示窗口的分辨率。
facecolor: 窗口的背景颜色。
edgecolor: 窗口的边框颜色。
matplotlib.pyplot.subplot(nrows, ncols, plot_number)
nrows: 子图的行数。
ncols: 子图的列数。
plot_number: 当前子图的编号。