问题描述
对于下面代码中的_, figs = d2l.plt.subplots(1, len(images), figsize=(12, 12))
一行,我对这个函数的参数传递有些不理解。查了一下这个函数,但是它的参数列表中没有看到叫做figsize
的参数啊,那这些参数到底是谁传递给谁了呢?
代码
# 本函数已保存在d2lzh包中方便以后使用
def show_fashion_mnist(images, labels):
d2l.use_svg_display()
# 这里的_表示我们忽略(不使用)的变量
_, figs = d2l.plt.subplots(1, len(images), figsize=(12, 12))
print('\n忽略的变量:')
print(_)
print(type(_))
for f, img, lbl in zip(figs, images, labels):
f.imshow(img.reshape((28, 28)).asnumpy())
f.set_title(lbl)
f.axes.get_xaxis().set_visible(False)
f.axes.get_yaxis().set_visible(False)
函数的参数列表
Signature:
d2l.plt.subplots(
nrows=1,
ncols=1,
sharex=False,
sharey=False,
squeeze=True,
subplot_kw=None,
gridspec_kw=None,
**fig_kw,
)