给定单个参数的子图的行为是什么?

What is the behaviour of subplot given single argument?

OpenCV.org教程有如下例子:

import numpy as np
import cv2 as cv
from matplotlib import pyplot as plt

img = cv.imread('drawing.png')
rows,cols,ch = img.shape

pts1 = np.float32([[50,50],[200,50],[50,200]])
pts2 = np.float32([[10,100],[200,50],[100,250]])

M = cv.getAffineTransform(pts1,pts2)
dst = cv.warpAffine(img,M,(cols,rows))
plt.subplot(121),plt.imshow(img),plt.title('Input')
plt.subplot(122),plt.imshow(dst),plt.title('Output')
plt.show()

这里subplot()的作用是什么? Docs 定义为,

The Matplotlib subplot() function can be called to plot two or more plots in one figure. Matplotlib supports all kind of subplots including 2x1 vertical, 2x1 horizontal or a 2x2 grid.

所提供的示例具有告诉高度与长度比率的参数,第三个参数用作索引。但这对我来说毫无帮助。

根据the documentation:

subplot(pos, **kwargs)

pos is a three digit integer, where the first digit is the number of rows, the second the number of columns, and the third the index of the subplot. i.e. fig.add_subplot(235) is the same as fig.add_subplot(2, 3, 5). Note that all integers must be less than 10 for this form to work.

因此plt.subplot(121)创建一个包含两个轴(1 行,2 列)的图,并使第一个(最左边)轴成为当前轴。